Dushanbe has a continental climate with hot, dry summers and cold winters. The most comfortable time to visit the city itself is spring (April–May) or autumn (September–October), when temperatures are mild and the surrounding hills are at their greenest or most colorful.
If your plan involves heading to the Pamir Highway or the Fann Mountains, the mountain passes are open from roughly June to October — with July and August being the best months for high-altitude trekking. Summer in Dushanbe itself can be very hot (over 35°C), which makes the cool Fann Mountains particularly appealing as an escape.
Avoid January and February if you dislike cold: temperatures drop below freezing and the city's Soviet-era district heating is unreliable.