There is one important real life example that I did not see mentioned in the other answers and that is eastern Germany. Even decades after the fall of the Berlin wall, you can still clearly identify the former GDR by just looking at a map of Germany, colored by religious views, even though both halves should have started on roughly even levels half a century earlier.
The state also fits your idea of a "moderate dictatorship". While the ruling party generally wasn't beyond throwing dissidents and opposition into jail (or even sentencing them to exile or death), most of the population lived comparatively (to other similar regimes) safe and free. Essentially as long as you (or members of your family) did not speak up against the government and its ideologies, you were guaranteed a normal boring life, that is education, a fixed job, a home and maybe at some point even your own car or the opportunity for a holiday in a far away (socialist) country.
The main reason for irreligion in the GDR seems to be directly linked to this. Since most of your fate is state controlled, to become somebody, you'll have to appear like a model citizen. Sure, you can actively participate in your church (They tried to forbid this initially, but quickly relented). But thanks to the Stasi, the state will take note of this. And if you want to go to university or get a promotion in your job, they will then look at your file and tell you about <PERSON>' and especially <PERSON>'s views about religion and how you do not seem to be quite suited for such an important socialist position.
This essentially was an open secret. 274
So while many may have still practiced their religion in private, they will have tried to look like a modern atheist in practice.
Now add one or two generations. You grow up in a place where most people outwardly appear to be atheist. The few people you see, that still go to church never seem to have achieved anything in life. In school you are taught that religion is just the "opiate of the masses" and that you should instead believe in science and progress. Your parents might have taught you a prayer or two in private but will probably not even have baptised you, out of fear for their and your future career.
In this environment you'll most likely develop into an atheist. Sure, at some point, you might realize what has happened, but by then it is most likely too late. Just knowing what prevented you from becoming religious will not suddenly turn you into a believer.
Of course this is a simplification and the reality is a bit more complex. For example there has always been a small core of religious people and a big difference in importance of churches between cities and countryside, but the general idea is clear. 767