Any static charge gained in the dryer will be lost on the first grounded object you touch.
Your issue is due to subsequent build-up of charge, either from lack of fabric conditioner, which contains anti-static compounds, or you are regenerating more static from your interaction between shoes & carpet.
For the first, use either commercially available anti-static dryer sheets; or even just a tightly screwed-up ball of aluminium foil in with the tumble-drying.
For the second, change your shoes. Leather soles create less static than artificial soles, though some artificial soles produce more than others. You'd have to test your existing shoes empirically to see which are best.
Also bear in mind that the entire effect is hugely influenced by atmospheric humidity, so don't think you've found the perfect solution on a rainy day.