The “midwit” mocking meme below has become stock propaganda used by alt-righters and other counter-enlightenment types (there are many variations, this just happens to be the one I came across today).

It seems to imply that the greater levels of religiosity or theism professed by below average IQ individuals are vindicated by the fact that above average IQ individuals also have higher rates of religiosity or theism.
There are a number of problems with this meme, but the biggest one is that it is simply not true.
I surveyed psychological and sociological research in several databases to explore this issue. Of all of the rigorous studies I found on IQ and its relationship to religiosity / theism the opposite findings were reported: individuals with above average IQ scores report lower levels of intrinsic religiosity (religious belief, as opposed to religious behavior [e.g., church-going, church involvement] ), theism, and other supernatural beliefs than average or below average cohorts (see Alsan et al., 2020; Kanazawa, 2010; Saroglou et al., 2002; Woellert & Luttig, 2018; Zuckerman et al., 2013).
In other words, religious or theistic belief was negatively correlated with IQ scores — that is, as IQ score rises, religiosity / theism goes down (see the graph below).

However, let’s make sure we are not strawmanning the implicit argument presented by this meme. In order to avoid this we will steelman it:
Premise 1: Below average IQ individuals report the highest levels of religiosity / theism.
Premise 2: Average IQ individuals report lower levels of religiosity / theism than below average IQ individuals.
Premise 3: Some above average IQ individuals report religious / theistic beliefs.
Conclusion: Therefore, religiosity or theism is not irrational.
This steelmanned version is valid, however, its soundness is questionable due to the complexity of the issue.
For instance, it is important to note that the religious, spiritual, or theistic beliefs of above average IQ individuals tends to be much different than those in the below average IQ cohort.
As discussed in Kanazawa (2010), above average individuals are more likely to have non-conforming or eccentric beliefs. That is to say, the theism or spiritual / religious beliefs professed by above average IQ individuals is much more likely to resemble the nuanced and freethinking views of Epicurus, Spinoza, Einstein, or Thomas Paine, than the dogmatic and supernatural views of the average Bible-believing religious person.
Other Problems:
The question of whether IQ tests fully capture intelligence (considering we don’t have a robust philosophical definition) is unresolved. Also, it is not clear that we have good reasons to consistently expect more epistemic rigor / rationality from high IQ persons, than from, say, high-average IQ persons. In fact, there is some evidence to suggest that a segment of the high IQ population may be predisposed to neuro-psychological epistemic dysfunction. I discuss both of these issues in my article The Fallacy of IQ Obsessiveness.
References:
Alsan, M., Phillips, M. R., & Wang, Q. (2020). Cognitive ability and religious beliefs: Evidence from the United States. Social Science Research, 95, 102336. https://doi.org/10.1016/j.ssresearch.2020.102336
Kanazawa, S. (2010). Intelligence and religious fundamentalism. Intelligence, 38(6), 669–674. https://doi.org/10.1016/j.intell.2010.06.007
Meisenberg, G., Patel, H., Woodley, M. A., & Rindermann, H. (2012). Is it smart to believe in God? The relationship of religiosity with education and intelligence. Temas em Psicologia, 20(1), 101–120.
Saroglou, V., Delpierre, V., Dernelle, R., & Dapy, X. (2002). Values and religiosity: A meta-analytic review of the nomological network of beliefs. Personality and Individual Differences, 33(5), 757–780. https://doi.org/10.1016/S0191-8869(01)00195-8
Woellert, A., & Luttig, M. (2018). Cognitive ability and religious fundamentalism: Evidence from the UK. Intelligence, 66, 1–7. https://doi.org/10.1016/j.intell.2017.11.009
Zuckerman, M., Silberman, J., & Hall, J. A. (2013). The relationship between intelligence and religiosity: A meta-analysis and some proposed explanations. Personality and Social Psychology Review, 17(4), 325–354. https://doi.org/10.1177/1088868313491624