Actually, I find it pretty hard to avoid religion in secondary world-building. It's difficult to create a culture without also giving it a belief system. This is particularly true for low-technology cultures, which forces me to wonder why belief systems seem so less essential in high-tech cultures. Once my creations reach something akin to steam engine technology, the culture no longer feels incomplete if I neglect to assign a belief system.
Why is that?
The initial reaction is to assume that technology and religion are incompatible, the one constantly displacing the other, but experience tells me this is untrue. Citizens of first world countries are not predominantly non-religious, and award-winning scientists are not automatically atheists. No, something far more subtle is going on here.
I think it may have to do with mobility. Also homogeneity, or rather, the lack thereof.
You see, once a society reaches a certain technology level -- oh, about the level of the steam engine -- travel becomes commonplace rather than exceptional. Instead of having isolated pockets of culture that rarely interact with each other, you begin to have more diversity. By the time you reach space-age technology (and assuming that there is no theocratic government enforcing religious homogeneity) your society is such a grab-bag of intermingled cultures and belief systems that describing all Martians as sky-worshipers sounds about as ludicrous as describing all Philadelphians as dog-owners.
So I guess what I'm wondering is whether the perceived lack of religion in science fiction actually has that much to do with the authors' (or the readers') biases, or whether it's simply that religion as a backdrop is not prevalent in high-technology stories. If you compare the number of stories that include religion as a plot element, is science fiction really less religious than fantasy or any other sub-genre?
I'm not convinced that it is, although I'd be happy to consider evidence for either case. ;)