In order to understand Hume's philosophy of religion, it is crucial to understand the basic tenets of his theory of knowledge. Hume was an empiricist in the tradition of John Locke and George Berkeley; he believed that all knowledge of matters of fact have to come through experience. If you want to know anything about what the world is like, he thought, in other words, you have to go out and investigate; you cannot simply sit in your armchair, think really hard and really well and hope to come up with knowledge. (This might just sound like common sense, but actually it remains a controversial claim among philosophers even today. In Hume's time it was even more controversial, because the 17th and 18th centuries were they heyday of the rationalist philosophers, such as Rene Descartes, Baruch Spinoza, and G.W. Leibniz, who believed that we could, in fact, arrive at knowledge of some very important matters of fact just by reasoning well, without investigating the world at all.)
Since Hume believed that all matters of fact had to be established through experience, the question of whether religious belief can ever be rational boiled down to the more specific question of whether religious belief can ever be justified by experiential evidence.
The hypothesis that religious belief can, in fact, be justified by experiential evidence is commonly called "empirical theism." It is empirical because it looks for evidence in experience, and it is theistic because it believes in a personal deity. In the Dialogues the position of empirical theism is represented by the character of Cleanthes.
At the time that Hume was writing, the argument from design was the most popular basis on which to rest a belief in empirical theism. According to the argument from design we can use the evidence of the natural world to arrive at knowledge about the nature of God in the following way: We see that the universe is like a machine insofar as it is perfectly and intricately ordered so that every part, from smallest to largest, fits harmoniously with every other part. We take note of the fact that every machine we have ever come across in our experience has been the product of intelligent design. Seeing the similarity between the universe and machines, we reason that since they are so analogous, they must certainly have analogous causes. We conclude, therefore, that the universe must also be caused by an intelligent designer. We thus arrive at knowledge about God's nature: we know that he resembles human intelligence.
Sir Isaac Newton was a proponent of the argument by design, as were many other British luminaries of Hume's day. The most famous version of the argument by design was put forward just a few years after Hume published the Dialogues by a man named William Paley. In his book Natural Theology Paley presents the consideration often dubbed the "Universal Watchmaker". Though Hume could not have possibly had this version of the argument in mind when he wrote the Dialogues it is still a helpful way to better understand the argument by design. According to the "Universal Watchmaker" line of reasoning, the universe is as intricate and as finely-tuned as a watch. If we were walking through the desert and stumbled upon a watch we would never once doubt that it was created by human intelligence. No one would be so silly as to suppose that all the parts of the watch just happened to come together by chance and to function so perfectly. The same, says Paley, could be said about our universe. Our universe is like a watch in that it runs so perfectly, everything being so well adapted to our survival and happiness. To conjecture that all of this could have come together by sheer chance is as absurd as maintaining that a watch could have come together by sheer chance.
Hume takes the argument by design to be the best case available to the empirical theist and so he spends the greater part of the book attacking this argument. However, many of his objections (such as the objection from the problem of evil) work equally well against any plausible argument for empirical theism. The brunt of his message is simply that there is not enough evidence in nature to justify our drawing any substantive conclusions about the world's ultimate cause. Empirical theism in any guise, in other words, cannot be made to work.
Though Hume was a notorious atheist, the Dialogues Concerning Natural Religion has a strong fideist bent to it. Fideism has been a popular position in the philosophy of religion. It claims that religious belief cannot be based on reason, but must be based instead on faith. According to fideism, therefore, the first fundamental step toward Christianity is skepticism: it is not until we undermine our trust in the power of reason, that we can come to worship God in the proper way, by opening ourselves up to revelation. In the context of the Dialogues fideism can be thought of as the opposite of empirical theism.
The fideist position is best represented in the Dialogues by the character of Demea. Demea is an orthodox Christian, who believes that God cannot be comprehended or understood at all, much less through reason. But the skeptical Philo also adopts a fideist position, particularly in the last chapter of the book. Whether this means that Hume himself was sympathetic to fideism has been a huge topic of debate among scholars ever since the book was first published.
Among Philo's attacks on empirical theism, the most famous and the most trenchant is the attack from the problem of evil. In its traditional form the problem of evil is seen as a challenge to the common conception of God. Given that there is evil in the world, the line of reasoning goes, what are we to conclude about God? Either he wishes to prevent evil and cannot, in which case he is not infinitely powerful; or else, he could prevent evil, but does not want to, in which case he may not be infinitely good; or, finally, perhaps he simply does not know the best way to run the world, in which case he is not infinitely wise. Theists want to maintain that God is infinitely powerful, good, and wise, and so the problem of evil poses a severe challenge to them.
Hume is not particularly concerned with this strong version of the problem of evil. Philo tells us that so long as we admit that God is incomprehensible there is no problem here at all: we must simply allow that while God's infinite perfection can, in fact, be reconciled with the presence of evil in the world, we have no idea how this reconciliation might occur. The only time the problem of evil really becomes a problem, he asserts, is when we try to claim that God is very strongly analogous to a human being. If God is anything like a human being, and can be judged by human standards of justice, kindness, and compassion, then he cannot be all good. In this sense, the traditional version of the problem of evil presents a real problem for the empirical theist insofar as the empirical theist believes in an anthropomorphized (i.e. human-like) God.
Hume's real concern with the problem of evil, however, is slightly different from this traditional concern about reconciliation. He is not so interested in the problem as a challenge to the traditional conception of God, as he is in the problem as a block to any inferences that we could make about God's moral nature. Given how much evil there is in our world, he argues, we cannot look at our universe and reasonably infer from the evidence that God is infinitely wise, good, and powerful. In fact, we cannot even reasonably conclude from the evidence that God is moderately good, wise, and powerful. If we were to try to draw any conclusions about God's nature just from the evidence afforded us by nature (which Philo does not believe we should do) the only warranted conclusion would be that God is indifferent between good and evil—that he is morally neutral. The argument from design then, as well as any other sort of argument for empirical theism, cannot possibly work as an argument that tells us about God's moral nature (and since God's moral nature is a pretty fundamental part of God, this weakness makes empirical theism seem pretty hopeless).
The argument from design is an a posteriori argument. That is, it seeks to prove its conclusion by investigating the world. In addition to a posteriori arguments there is also another kind of argument, an a priori argument. An a priori argument seeks to prove its conclusion just by analyzing concepts using the faculty of reason. Because Hume is an empiricist he does not believe that we can ever prove any matters of fact using a priori arguments. However, he nonetheless devotes a chapter of his book to attacking the most famous a priori argument for the existence of God: the ontological argument.
The ontological argument comes in many forms. The first person to propose a version of the argument was the medieval philosopher St. Anselm. Other famous versions have been put forward by René Descartes, Baruch Spinoza, and G.W. Leibniz. In the Dialogues it is Demea who suggests that a version of the ontological argument might serve as a plausible alternative to the flailing argument from design.
The version of the ontological argument that Demea puts forward goes as follows. (1) Every effect has some cause. (2) Therefore, there must either be an infinite chain of causes or else there must be some ultimate cause that is its own reason for being (i.e. a necessarily existing thing). (3) There cannot be an infinite chain of causes because then there would be no reason why that particular chain exists and not some other, or none at all. (4) Therefore, there must be a necessarily existing thing, i.e. God.
Both Cleanthes and Philo have a field day ripping into this argument. Cleanthes argues, first of all, that matters of fact cannot be proved a priori, and shows why this is the case. He also objects that the argument only proves that there is some necessarily existing thing and that this necessarily existing thing could just as easily be the material world as it could be God (neither would be more inexplicable and mysterious than the other). In addition, he mentions, there is actually no good reason why there cannot be an infinite chain of causes. Philo then steps in with an added objection: for all we know, he says, there is some necessity to the material world that we do not understand. There might be some laws that explain everything without recourse to a necessarily existing being.
By arguing against the ontological argument (and, in the process, against all a priori theological arguments), Hume successfully covers all of his bases. Without any a posteriori arguments, and without any a priori arguments, there can be no rational basis for religious belief. Neither reason nor experience can justify a belief in God's nature.