Robert R. Chase has a long and interesting article about the ambivalence of science fiction writers when it comes to depicting religion in their novels. He discusses such authors as Arthur C. Clarke, Robert A. Heinlein, Philip K. Dick, Robert J. Sawyer and Gene Wolfe, among others.
Last year, the blog SF Signal asked writers to weigh in on the question of whether science fiction is antithetical to religion. Fifteen writers took up the challenge. Their outlooks ranged from the sharp-edged atheism of James Morrow to the enthusiastic Christianity of the convert John C. Wright. Readers—and, no doubt, the editors—expected loud anathemas, biting sarcasm, and lordly sneers. Instead, to their surprise and disappointment, a polite consensus emerged: No, the two are not antithetical.
The reasons were varied. Some referenced the many religious science-fiction books and authors as proof that science fiction and religion cannot be antithetical. The atheists, for the most part, recognized that religious belief is a general human characteristic that is not likely to go away, Arthur C. Clarke to the contrary, and that writers thus must be willing to take it seriously to describe characters realistically.