With all the current troubles in the Muslim dominant old republics I can't see how they actually got that to work. Did they just turn a blind eye?
The USSR was officially atheist. That doesn't mean they were forcing people to stop believing in god - even they realized such effort would be fruitless. But certainly they did persecute the clergy who didn't collaborate with the regime - though I'm not aware of any such case with Muslims, perhaps because Islam doesn't have any clergy as such.
Timing is important, as before WW2 there was more persecution, but after the war the government did turn a blind eye. You can't get rid of religion in a diverse place like the USSR, it would only make enemies. You could do what you want in terms of religion; although in official terms it probably is stated differently.
Disclaimer : this is only AP Euro speaking. I have no further education on the subject.
The USSR did manage to secularize its Muslim population, although it would be a waste of resources to forcibly convert people to atheism after Stalin. Considering Tajikistan, Afghanistan and Iran share a common religion, ancient history, and language, the Soviets did a pretty good job. I've never heard of Islamist terrorist blowing themselves up in Tajikistan or supporting Hezbollah or destabilizing the world, have you?