The book that got me hooked on sci fi when I was a teenager was one about a society which was run by white monks (from memory I think). No one questioned them or their beliefs as everyone feared them. The hero of the story a young lad was a heretic who did not believe in their god and eventually got arrested. He was interrogated and maintained his views and when he finally got in front of the main man he asked how you became a white monk. The answer was by being a heretic. I've tried to find the book called I think The Heretic but no luck! Any ideas?
I don't recall God at all - although Goodreads reviews indicate there is a religion, but this reminds me of the Children of the Star trilogy by Sylvia Louise Engdahl: This Star Shall Abide, Beyond the Tomorrow Mountains and The Doors of the Universe.
The main character, Noren, rebels against society in the first book - he thinks it's wrong that Scholars and their employees the Technicians are the only ones who can use metal machinery and thinks some of the rules - such as not drinking straight out of a stream or river - are ridiculous. He gets labelled a heretic and gets sent to be punished by the Scholars and recant. He refuses to, and is ultimately made a Scholar for refusing to recant.