“There are always epidemics no one understands, coming out of nowhere,” a character comments in Larry Kramer’s immense, sprawling, subversive, slightly insane and brilliant new novel, “The American People: Volume 1: Search for My Heart.” Readers familiar with Kramer’s history will prick up their ears: This is a writer all but synonymous with an epidemic.

Kramer rose to national prominence with his scalding 1978 novel, “Faggots,” which used its hapless main character, Fred Lemish, as a means to expose the hollow, desperate, party-circuit life led by gay men in New York City and on Fire Island. The mirror was unflattering and a considerable backlash was directed against its author. Only a few years later, a mysterious disease began decimating the ranks of precisely the kind of promiscuous gay partygoers Kramer had savaged in his novel. AIDS, as yet unexplained, had struck New York City.

Kramer responded with activism and art. In 1982, he helped found the Gay Men’s Health Crisis, an organization dedicated to raising awareness and money for the victims of the rampant AIDS epidemic, and in 1985 he wrote “The Normal Heart,” a wrenching play about the efforts of a Kramer stand-in to confront institutional inertia about a new disease attacking gay men. The play became a runaway hit and was made into an Emmy-winning TV movie in 2014. In 1987, Kramer inspired the formation of ACT UP, a more politically active version of the Gay Men’s Health Crisis, from which he had earlier split on the question of in-your-face activism.

In the following years, there were marches and protests and plays (including “The Destiny of Me,” which was a Pulitzer finalist), and fugitive rumors about a Big Book, a long-germinating magnum opus. In “The American People” we at last have that book — or part of it, anyway, since “Search for My Heart” is billed as “Volume 1.”

The story is enormous, and Fred Lemish is again our master of ceremonies. The book opens with him sitting in his Washington Square apartment, finishing up “his history of The American People.” But the organizing principle of the work, his and Kramer’s, will not be the past so much as pathology: Throughout the course of prehistory and human history, we follow the insidious progress of a disease. It’s called the Underlying Condition, and the novel’s boisterously readable narration digs right into its primeval origins: “From all you’ll be learning from me you might think that monkeys can kill you, that one day a long time ago a monkey ate a man or a man ate a monkey and you could die for it.”

The tracking of this disease forms a convenient backdrop for Kramer’s clear main purpose: “The American People” is a reimagining of American history as a gay epic. From the earliest settlers through the Puritans and the Founding Fathers and the Civil War and right up to the 1950s, readers are given the gay version of every Tom, Dick and Abraham Lincoln, all written with the hilarious ferocity and unflinching brutality of Thomas Pynchon or John Rechy. At one point, when Lemish/Kramer is telling us about the connection between 19th-century morality scold Anthony Comstock and his young protege J. Edgar Hoover, he remarks, “Interesting how all these guys find each other” — and in “The American People,” these guys always do.

No American sacred cow is left untipped. Increase and Cotton Mather and fire-and-brimstone preacher Jonathan Edwards are battling private demons (“Numerous Mathers told you that God hates you unless you do this or that and x and y. Edwards just tells you that God hates you”). No one yet has the goods on John Adams, but BBenjamin Franklin is accused of a decalogue’s worth of sins, including that “he had a black man murdered for loving him.” George Washington and Alexander Hamilton are more than just friends, and — in what will surely be the book’s most-cited sacrilege —Lincoln and John Wilkes Booth have some fateful meetings prior to Ford’s Theatre.

It’s a protracted display of pyrotechnic virtuosity, a gay fantasia on the life of an entire country, and when one character blurts out about another, “What a combination of truth and malarkey you are!,” some readers will feel like shouting something similar at Kramer himself. Those readers will be further frustrated by the fact that the book’s most moving section — set in a Nazi concentration camp where a beautiful young Jewish boy named Danny Jerusalem becomes the adored pet of the doctor in charge of gruesome experiments on prisoners — has nothing to do with the American people and indulges in no celebrity parodies, no in-your-face activism.

There are many such cross-purposes in this brawling, angry book. Historians such as Stacy Schiff and Ron Chernow are cited throughout the book, hinting at its explicitly nonfiction roots. But instead of that — pardon the term — straight history, we get a novel in which all of America is raucously outed.A sequel covering the years of Kramer’s own life is almost too terrible a thing to be imagined.

Donoghue is managing editor of the online magazine Open Letters Monthly.