Wealthier people/nations are less religious, it is not that less religious people/nations are rich.
Not only wealthier people are more likely to have a better education than the average but also they need a supernatural being less.
For example, if your child is sick and you cannot afford a proper treatment for her you may find praying to God is your last hope. Whereas, if your child is sick and you can afford her treatment in the best way there is then prayers are not your only hope.