A Manhattan accountant cooked the books at a prestigious literary agency that represents top writers, including “Fight Club” author Chuck Palahniuk, bilking its clients of millions and leaving the company on the brink of bankruptcy, according to legal papers.

Darin Webb, 47, faces 20 years in jail on wire-fraud charges for embezzling $3.4 million from storied Manhattan agency Donadio & Olson, according to a recently unsealed federal criminal complaint.

Although the agency, which also represents the estates of “Godfather” writer Mario Puzo and radio legend Studs Terkel, was not named in court papers, a lawyer representing the firm confirmed to The Post that Donadio & Olson was the subject of the alleged theft.

The agency was founded in 1969 by Candida Donadio, a former secretary from Brooklyn who shot to fame in the late 1950s after she sold Joseph Heller’s “Catch-22” and Philip Roth’s “Goodbye, Columbus” to publishers.

Donadio, who died in 2001, also represented novelists Thomas Pynchon and William Gaddis.

The stolen money — allegedly lifted between January 2011 and March of this year — was earmarked for author royalties and advances, the complaint says.

But the theft could be exponentially more, a source told The Post, noting that a forensic accountant is combing through Donadio & Olson’s books all the way back to 2001, Webb’s first year at the agency.

He allegedly fessed up to the theft in March in a videotaped interview with company executives and their attorneys at the agency’s Chelsea office, saying he filed monthly financial reports that “contained false and fraudulent representations in order to accomplish the theft and evade detection,” the complaint states.

Webb was arrested May 15 by the FBI and is out on $200,000 bail.

Some writers represented by the agency told The Post they had not been contacted about the theft, and did not know if it affected their royalties.

“This is the first I heard of it,” said McKay Jenkins, a nonfiction author.

Bert Fields, a lawyer representing the Puzo estate, said he learned of the arrest from The Post.

The alleged theft was first discovered last fall when an unidentified author who was expecting to receive a $200,000 advance from his publisher asked Webb why he had not received the payment.

According to the complaint, Webb put the author off for months.

“The author did not receive the payment because Webb had converted the funds to Webb’s own use,” says the complaint.

“The agency’s singular focus at this time is ensuring that all of its impacted clients are made whole to the greatest extent possible, and the agency is cooperating in every possible way with the government’s efforts,” said Matthew Adams, a lawyer for Donadio & Olson.

Calls and an e-mail to Webb’s attorneys were not returned.