The end nears
As Sandworms of Dune begins, the passengers of the no-ship Ithaca continue their search for a new home world for the Bene Gesserit, while Duncan Idaho evades the tachyon net of the old couple Daniel and Marty, now known to be thinking machine leaders Omnius and Erasmus. Among the inhabitants of the Ithaca are young gholas of Paul Atreides, Lady Jessica and others. Back in the Old Empire, Mother Commander Murbella of the New Sisterhood attempts to rally human kind for a last stand against the thinking machines. The new Face Dancers continue to infiltrate the main organizations of the Old Empire at all levels, having also sent their gholas of Paul Atreides (called Paolo) and the Baron Vladimir Harkonnen to the thinking machine capital, Synchrony.
At the prompting of Face Dancer infiltrators, the Spacing Guild has begun replacing its Navigators with Ixian navigation devices and cutting off the Navigators' supply of melange. Navigator Edrik and his faction have commissioned Waff, the imperfectly-awakened ghola rescued by the Guild from the Bene Gesserit attack on Bandalong, to create "advanced" sandworms able to produce the melange they so desperately require. He accomplishes this by altering the DNA of the sandtrout stage and creating an aquatic form of the worms, which are then released into the oceans of Buzzell. Adapting to their new environment, these "seaworms" quickly flourish, eventually producing a highly-concentrated form of spice, dubbed "ultraspice."
Meanwhile, Murbella commissions Ix to copy the destructive Honored Matre Obliterators for use on the fleet of warships she has ordered from the Guild. However, Ix is now secretly controlled by Face Dancer leader Krone; previously acting as a minion of Omnius, he continues his own plot for Face Dancer domination of the universe. Omnius' forces have begun striking world after world, releasing a deadly virus and then pressing on to the new string of inhabited worlds. The thinking machine plague arrives at Chapterhouse and cripples the Sisterhood, but they rally the allied planets into one last great stand.
Aboard the Ithaca, Sheeana restarts the ghola project. Gholas of Serena Butler, Gurney Halleck and Xavier Harkonnen are about to be born when the axlotl tanks are poisoned, killing all three ghola babies and the tanks. Saboteurs are suspected, as many of the ship's systems have also been failing. Scytale, the last Tleilaxu Master, finally reawakens his own ghola's past memories, but only by dying in front of his younger self. The gholas of Wellington Yueh, Stilgar and Liet-Kynes regain their memories through various traumatic experiences. Desperate to replenish their supplies, the Ithaca lands on the planet Qelso, a world slowly being terraformed into a desert planet by the introduction of sandworms years before by the Bene Gesserit. Stilgar and Liet-Kynes decide to remain behind to help the natives slow the encroaching desert, and prepare them for the inevitable.
Having successfully completed his attempts to create a new incarnation of sandworm, Waff begs Edrik to return him to the ruined planet of Rakis so that he can spend what little time to live he has left attempting to reintroduce the worms there as well. Unsuccessful, Waff resigns himself to failure and prepares to die; as the last of his sandworm specimens perish, a dozen true sandworms erupt from beneath the surface. Waff realizes that the pearl of God Emperor Leto II's awareness that each sandworm carries had foreseen the Honored Matre attack on Rakis, and buried themselves deep beneath the planet's surface. Knowing the planet has begun healing itself, Waff is consumed by a worm, rejoicing that his prophet has finally returned. Meanwhile, Edrik and the ultraspice are intercepted by Krone, who seizes the spice and kills the Navigator.
The saboteurs are eventually revealed to be the Rabbi and the ghola of Thufir Hawat, who had apparently been murdered and replaced with Face Dancers back on the planet of the Handlers during the events of Hunters of Dune. In the ensuing chaos that follows the discovery of the Face Dancers, the Ithaca is ensnared by the tachyon net. Miles Teg sacrifices his life in an unsuccessful attempt to prevent their capture. With escape impossible, the Ithaca is brought to Synchrony. They are met by a party led by the ghola of Vladimir Harkonnen. Seeing the young ghola of Alia when he arrives, he immediately kills her; the original Alia had murdered his original self 5,000 years before. The Bene Gesserit gholas of Paul, Lady Jessica, Chani, and Yueh are then taken to see Omnius and Erasmus.
Omnius explains that to complete his domination of humanity, he requires the superior Kwisatz Haderach of the two Paul gholas. Paolo and Paul are forced to duel, during which Paul is mortally wounded. Victorious, Paolo takes the ultraspice; overwhelmed by the rapid onset of perfect prescient vision, he slips into a coma. Paul, at the urging and efforts of Yueh, Chani and Jessica, slowly regains his past memories and is able to repair the damage to his body using Bene Gesserit physiological control. Under the guise of aiding Paolo, Yueh takes his revenge by killing Baron Harkonnen, who had orchestrated the torture and death of Yueh's wife Wanna in their original incarnations.
As this is happening, Murbella has all the new ships in place and is finally ready to launch her fleet against Omnius' oncoming armada. But the Obliterators and Ixian navigation devices all suddenly fail; Murbella realizes that they have been sabotaged. When it appears that defeat at the hands of the thinking machine forces is imminent, the Oracle of Time appears with a thousand ships piloted by Guild Navigators and begins to attack the machines. This assault leaves the machine fleet in pieces. The Oracle then tells Murbella that she is going to Synchrony to stop Omnius once and for all; she folds space and a visual manifestation of the Oracle appears in the room where Paul and Paolo have been dueling. The Oracle then removes every aspect of Omnius and transports the Evermind away into another dimension forever.
The ultimate Kwisatz Haderach
Sheeana and the young Leto II ghola free the sandworms from the Ithaca's cargo hold, and the worms wreak havoc throughout Synchrony. Leto II regains his memories and after the battle is done, he tells Sheeana that he must now go back into the dreaming; Leto walks into the belly of the largest worm, Monarch, and the seven worms twist together and form into one worm before digging deep into the ground.
Fresh from fighting the thinking machines outside on Synchrony with Sheeana, Duncan enters the chamber where a recovering Paul, his memories now restored, reveals that Duncan is the final Kwisatz Haderach, having evolved and perfected himself through thousands of years of ghola rebirth and altered DNA. Erasmus then explains that he was the mastermind behind the rebuilding of the Synchronized Worlds. A mutinous Khrone declares that the universe now belongs to his Face Dancers, as both humans and machines have been crippled. Amused by Khrone's attempt to seize power, Erasmus explains that a fail-safe system had been built into the Face Dancers; the independent robot kills Krone and his party — and then all Face Dancers across the universe — with the simple flip of a mental switch. This action kills off tens of millions of Face Dancers, exposing how much they have infiltrated human society. Erasmus then offers Duncan a choice: with both humans and thinking machines battered and beaten, Duncan can choose either destruction for one side or recovery and healing for both. Choosing peace over victory, Duncan and Erasmus then merge minds. Erasmus imparts Duncan with all the codes required to run the Synchronized Worlds, as well as all of Erasmus' knowledge. Duncan now stands as the bridge between humans and machines. With little left for him, Erasmus again expresses his desire to learn everything possible about what it is to be human — Erasmus asks for Duncan to help him die. As Duncan shuts Erasmus down, he shares one of the many deaths he experienced with the independent robot. In "death," Erasmus retains the image of the old woman, Marty.
Back in the Old Empire, Murbella's forces are preparing to attack Omnius' second wave when the machines all suddenly stop. With the Oracle having taken Omnius, a Navigator brings Murbella to Synchrony. She and Duncan are reunited, and he explains his intent to end the divide between humans and thinking machines — the two will co-exist. Duncan gives Synchrony to Sheeana for her Orthodox Sisterhood, while he returns with Murbella to help lead the new human-machine mode of life.
On Qelso, the gholas of Stilgar and Liet-Kynes continue to aid in the attempt to hold back the expanding desert, while simultaneously teaching the planet's occupants how to adapt to the changes that will inevitably come. Under Duncan's control, a thinking machine convoy lands on the planet; Duncan offers the gholas the aid of the thinking machines in holding back the desert. He tells Stilgar and Kynes that just as he has become both man and machine, Qelso will become both desert and forest.
On Caladan, the gholas of Lady Jessica and Wellington Yueh have returned to the ancient Atreides castle. Having removed all traces of the Baron's occupancy, the two discuss how they will go forward with their lives. Accompanying them is the unawakened ten-year-old ghola of Leto I. Looking forward to the time when his memories will be restored, Lady Jessica finds solace in the fact that she will be reunited with her Duke.
With the aid of the Tleilaxu Master Scytale, Sheeana and the Orthodox Sisterhood on Synchrony have reestablished the ancient Bene Gesserit breeding program, resolving to never again breed another Kwisatz Haderach. At her side, Sheeana has a young ghola of Serena Butler, heroine of the Butlerian Jihad. Along with gholas of the Tleilaxu Masters, Scytale has grown Tleilaxu females from newly-discovered cells, vowing that they will never again be forced into becoming axlotl tanks, in the hopes that this will prevent the creation of a vengeful enemy such as the Honored Matres from ever occurring again, and also vowing to never again allow the Masters to corrupt the recovering Tleilaxu people.
On the recovering planet Dune, the awakened gholas of Paul and Chani go about restoring the planet to its former glory. They have reverted back to the ways of the ancient Fremen, resolving to lead simple lives and unafraid of the plots and schemes that threatened them in their previous lives. Now able to devote all of his attention to her, Chani remarks that Paul has finally learned how to treat his wife. As the novel closes, Paul reaffirms his love for Chani, telling her he has loved her for five thousand years.