I'm unfamiliar with that episode, not to mention that entire show.If Gene actually was an athiest, explain his Have Gun, Will Travel episode "The Hanging Cross."
Beliefs change. Writer's write. Gene Roddenberry was raised as a Southern Baptist but later rejected religion. Who knows what he really believed?
As mentioned previously, it is possible to be atheist and write about religious themes. People familiar with my views here and on a couple of other forums I've been part of for many years know I'm atheist and I don't budge. But I've also been working on a writing project in an alt-universe version of the 11th century in which I've basically thrown out real history so I don't have to shoehorn it into the computer game storyline I'm adapting to prose. This was also a way to avoid dealing with the religious aspects of life back then.
However, I do know that it would be unrealistic for people to not have some sort of religion in their lives in medieval times, so I created one. It's fairly benign as religions go - no instructions to kill or enslave "the other" and new knowledge is welcomed and used where practical.
The main characters in my story strive to better themselves, just as the main characters in Star Trek tend to want to become better people over the course of their lives, improving themselves in various ways.
I may not be able to write a serious Star Trek story to save my life, but it has influenced how I look at other things I write. Some things are just "the logical thing to do."