I, too, found Star Trek heartening while going through a private fundamentalist Christian middle school. It gave me a glimpse of a future where reason had won the day, and what we might achieve once assured we had a long term future in space, instead of facing near term supernatural extermination on Earth.
It is interesting to note that the Federation isn’t atheistic per se. The original Enterprise had a non-denomination church onboard, which is seen in a couple of episodes. It was just rarely used because almost nobody in the crew was religious.
It presaged the modern, widely cited trend of millenials leaving the church, but not identifying as atheists. The so-called “nones”. They are not necessarily antagonistic to religion but have no use for it. The decline in religiosity in first world countries is attributed by sociologists to the fact that religion is usually an emotional refuge from suffering and scarcity.
As the world continues to gradually improve, the conditions people turn to religion to escape from will fade away, and religion along with it. Barring a third world war or something, we’re on track to achieve this outcome within our lifetimes.