More than 21,000 years in the future, humanity has settled on countless habitable planets, which are ruled by aristocratic Great Houses that owe allegiance to the Padishah Emperor Shaddam IV. Though many forms of science and technology have evolved greatly since the twentieth century, artificial intelligence and advanced computers are prohibited. Due to the absence of these technologies, humans have adapted their minds to become capable of extremely complex tasks, including mental computing, a task undertaken by trained Mentats. The powerful, matriarchal Bene Gesserit, who hope to further the human race through controlled breeding, and the Spacing Guild, which holds a legal monopoly on interstellar travel, both rely on the "spice" melange to facilitate their advanced mental abilities. The use of melange also improves general health, extends life and can bestow limited prescience.
As melange can be found only on the desert planet Arrakis, it is extremely valuable and is often used as currency. The CHOAM corporation, which determines the income and financial leverage of each Great House, controls allocation of melange. The Spacing Guild's Navigators depend on the prescience melange provides to safely plot the travels of their ships, called heighliners, enormous freighters capable of transporting people, goods, and non-interstellar spacecraft at faster than light speeds. The Bene Gesserit sisterhood depends on mental and physical abilities provided by melange, powers that are found to be even more advanced in Bene Gesserit Reverend Mothers, who have undergone a deadly ritual which unlocks their Other Memory, the ego and experiences of one's female ancestors. Due to Reverend Mothers' inability to access the memories of their male ancestors, the Bene Gesserit have a secret, millennia-old breeding program, with a goal of producing a male Bene Gesserit, called the Kwisatz Haderach. The Kwisatz Haderach would be capable of accessing all male ancestral memories and could possess "organic mental powers" that can "bridge space and time". With this Kwisatz Haderach under their control, the Bene Gesserit hope to better guide humanity toward their goals, and at the time of the novel they believe that this plan is nearing fruition.
The planet Arrakis itself is completely covered in a hostile desert ecosystem. It, however, is also sparsely populated by a human population of seemingly-native Fremen, ferocious fighters who have adapted to the harsh climate and secretly can ride the planet's giant sandworms. The Fremen also have complex rituals and systems focusing on the value and conservation of water on their arid planet; they conserve the water distilled from their dead, consider spitting an honorable greeting, and view tears shed for the dead as a most profound tribute or sign of reverence (seeing as the water is desperately needed by the living). The novel suggests that the Fremen have even adapted to the environment physiologically, with their blood able to clot almost instantly to prevent water loss. The Fremen culture also values melange, which is found in the desert and harvested with great risk from attacking sandworms, who are attracted to any rhythmic activity on the dunes. As they have done on other planets with populations considered to be superstitious, Bene Gesserit missionaries have implanted religions and prophecies on Arrakis that can be used to the advantage of any Bene Gesserit who may find herself on the planet. This manipulation has given the Fremen a belief in a male messiah, the Lisan al-Gaib, or "voice of the outer world". The Lisan al-Gaib is prophesied to one day come from off-world to transform Arrakis into a more hospitable world.
Padishah Emperor Shaddam IV of House Corrino grants Duke Leto Atreides control of the lucrative spice-mining operations on Arrakis. Though Leto and his advisors suspect the boon to be some sort of trap, it is an opportunity for House Atreides to gain power and wealth, and politically Leto cannot refuse. The Emperor has indeed become threatened by Leto's growing popularity within the convocation of ruling Houses known as the Landsraad, and decides that House Atreides must be destroyed. Unable to risk an overt attack on a single House without suffering a backlash from the Landsraad, the Emperor instead plots to use the centuries-old feud between House Atreides and House Harkonnen to disguise his assault, enlisting the brilliant and power-hungry Baron Vladimir Harkonnen in his plan to trap and eliminate the Atreides. Complicating the political intrigue is the fact that Leto's son Paul Atreides is an essential part of the Bene Gesserit's secret, centuries-old breeding program. Though ordered to use her physiological training to conceive a daughter, Leto's concubine, the Bene Gesserit Lady Jessica, had instead chosen to give the Duke a male heir out of love for him. The Bene Gesserit leader Reverend Mother Mohiam, not used to being defied, is wary of the potential repercussions of Jessica's choice on both young Paul's genetics and the breeding program itself.
On Arrakis, the Atreides are able to thwart initial Harkonnen traps and complications while simultaneously, through Leto's Swordmaster Duncan Idaho, building trust with the mysterious desert Fremen, with whom they hope to ally. However, the Atreides are ultimately unable to withstand a devastating Harkonnen attack, supported by the Emperor's fearsome, virtually invincible Sardaukar troops disguised as Harkonnen troops and made possible by a traitor within House Atreides itself, the Suk doctor Wellington Yueh. House Atreides is scattered, and of its principal retainers, Mentat Thufir Hawat is taken by the Baron Harkonnen and eventually provides his reluctant services whilst formulating a plan to undermine the Baron; the troubadour-soldier Gurney Halleck escapes with the aid of smugglers, whom he joins; and Duncan Idaho is killed defending Paul and Jessica. Per his bargain, Yueh delivers a captive Leto to the Baron, but double-crosses the Harkonnens by ensuring that Paul and Jessica escape. He also provides Leto with a poison-gas capsule in the form of a false tooth, which Yueh instructs a drugged Leto to use to simultaneously commit suicide and assassinate Harkonnen. The Baron kills Yueh, and Leto dies in his failed attempt on the Baron's life, though the Baron's twisted Mentat Piter De Vries dies with him. Paul and Jessica flee into the deep desert, escaping the Harkonnens by following instructions laid out in advance by the traitor Yueh.
Jessica's Bene Gesserit abilities and Paul's developing skills help them join a band of Fremen. Paul and his mother quickly learn Fremen ways while teaching the Fremen what they call the "weirding way", or the Bene Gesserit method of fighting. Jessica becomes a Reverend Mother, ingesting the poisonous Water of Life while pregnant with her second child; this unborn daughter Alia is subjected to the same ordeal, acquiring the full abilities of a Reverend Mother before even being born. Paul takes a Fremen lover, Chani, with whom he fathers a son. Years pass, and Paul increasingly recognizes the strength of the Fremen fighting force and their potential to overtake even the "unstoppable" Sardaukar and win back Arrakis. The spice diet of the Fremen and his own developing mental powers cause Paul's prescience to increase dramatically, allowing his foresight of future "paths" of possible events. Regarded by the Fremen as their prophesied messiah, Paul grows in influence and begins a jihad against Harkonnen rule of the planet under his new Fremen name, Muad'Dib. However, Paul becomes aware through his prescience that, if he is not careful, the Fremen will extend that jihad against all the known universe, which Paul describes as a humanity-spanning subconscious effort to avoid genetic stagnation.
Both the Emperor and the Baron Harkonnen show increasing concern at the fervor of religious fanaticism shown on Arrakis for this "Muad'Dib", not guessing that this leader is the presumed-dead Paul. Harkonnen plots to send his nephew and heir-presumptive Feyd-Rautha as a replacement for his more brutish nephew Glossu Rabban — who is in charge of the planet — with the hope of gaining the respect of the population. However, the Emperor is highly suspicious of the Baron and sends spies to watch his movements. Hawat explains the Emperor's suspicions: the Sardaukar, all but invincible in battle, are trained on the prison planet Salusa Secundus, whose inhospitable conditions allow only the best to survive. Arrakis serves as a similar crucible, and the Emperor fears that the Baron could recruit from it a fighting force to rival his Sardaukar, just as House Atreides had intended before their destruction.
Paul is reunited with Gurney. Completely loyal to the Atreides, Gurney is convinced that Jessica is the traitor who caused the House's downfall, and nearly kills her before being stopped by Paul. Disturbed that his prescience had not predicted this possibility, Paul decides to take the Water of Life, an act which will either confirm his status as the Kwisatz Haderach or kill him. After three weeks in a near-death state, Paul emerges with his powers refined and focused; he is able to see past, present, and future at will, down both male and female lines. Looking into space, he sees that the Emperor and the Harkonnens have amassed a huge armada to invade the planet and regain control. Paul also realizes that his ability to destroy all spice production on Arrakis using the Water of Life is his means of seizing control of it.
In an Imperial attack on a Fremen settlement, Paul and Chani's infant son Leto II is killed and the four-year-old Alia is captured by Sardaukar. She is brought to the planet's capital Arrakeen, where the Baron Harkonnen is attempting to thwart the Fremen jihad under the close watch of the Emperor. The Emperor is surprised at Alia's defiance of his power and her confidence in her brother, whom she reveals to be Paul Atreides. At that moment, under cover of a gigantic sandstorm, Paul and his army of Fremen attack the city riding sandworms; Alia assassinates the Baron and escapes during the confusion. Paul defeats the Sardaukar and confronts the Emperor, threatening to destroy the spice, thereby ending space travel and crippling both Imperial power and the Bene Gesserit in one blow. The new Baron Harkonnen, Feyd-Rautha, challenges Paul to a knife-duel in a final attempt to stop his overthrow, but is defeated despite an attempt at treachery. Realizing that Paul is capable of doing all he has threatened, the Emperor is forced to abdicate and to promise his daughter Princess Irulan in marriage to Paul. Paul ascends the throne, his control of Arrakis and the spice establishing a new kind of power over the Empire that will change the face of the known universe. But in spite of his power, Paul discovers that he will not be able to stop the jihad in his visions. His legendary state among the Fremen has grown beyond his power to control it.