In 1980, legendary comedian Andy Kaufman and his writing partner, Bob Zmuda, wrote a script for a film called “The Tony Clifton Story,” based on a character of Kaufman’s.

On Page 124, there is a block of dialogue intended for Kaufman to speak as himself, informing viewers of Clifton’s demise. Among the lines:

“On June 12, 1980 . . . Tony Clifton, at the age of 45, died of cancer at Cedars-Sinai Hospital in Hollywood, California.”

Four years later, at age 35, Kaufman himself would, supposedly, die — from cancer at Cedars-Sinai Hospital in Hollywood, California.

It was no coincidence, Zmuda reveals in a new book, “Andy Kaufman: The Truth, Finally” (BenBella Books), written with Lynne Margulies, Kaufman’s girlfriend.

Not only does he firmly believe that Kaufman faked his death, but that Kaufman will be emerging to reveal his great prank to the world very soon.

Longtime obsession

Zmuda believes the germ of this idea — and, it appears, many of Kaufman’s mental-health issues — began with an incident in his childhood.

As Zmuda tells it, Kaufman, who first appeared to be “a normal young boy,” had a grandfather he adored called “Papu” with whom he would “sing songs, play games and just have a great time.” But when Papu died, Kaufman’s parents made “a horrible mistake.”

Instead of telling young Andy, his parents, fearing his heartbreak, said Papu “went away to another country far, far across the ocean and wasn’t coming back.” So rather than learning to deal with death, Kaufman thought he had been abandoned.

This, Zmuda says, is when Kaufman began withdrawing from the world. He would “lock himself in his room and start talking to the walls.”

But it also, Zmuda believes, planted the idea that life and death “could be manipulated.”

“It was here where I believe Andy would develop the concept of ‘bending reality’ to suit his needs,” writes Zmuda. “If his parents could fake his grandfather’s not dying, Andy would just fake himself dying.”

Kaufman, a “Saturday Night Live” regular who rose to fame on the sitcom “Taxi” and was immortalized by Jim Carrey in 1999’s “Man on the Moon,” was known for stunts, such as once taking his entire Carnegie Hall audience out for milk and cookies after a performance.

He began talking with Zmuda about faking his death several years before his “actual” death.

When SNL’er John Belushi died in March 1982, Kaufman was very upset — not for normal reasons, but because, as he told manager George Shapiro, “John Belushi is pulling my stunt, faking his death.”

Shapiro, who recalls in the book that Kaufman truly believed this for a time, says Kaufman spoke often of faking his own death. “Could you imagine how this is going to blow everyone’s mind?” he would say.

To ‘die’ laughing

Zmuda presents transcripts of several of his conversations with Kaufman on this topic.

Sometime in 1982, Kaufman called Zmuda at 4 in the morning, telling him he had decided to fake his death and insisting he meet him right away.

A half-hour later, as Kaufman devoured a bowl of chocolate ice cream at Canters Deli in Los Angeles, Zmuda told him what he was planning was illegal and refused to have any part in it.

Another time, they argued after Kaufman admitted telling a woman he was going to “fake my death by making people believe I had terminal cancer.” (The woman’s response, according to Kaufman? “She thought it was disgusting, and if I ever brought it up again, she’d never talk to me.” Zmuda had to tell him that “people ­really get wigged out when you start f- -king with death.”)

Zmuda also recalls a conversation in which Kaufman started coughing, and Zmuda said: “Stop with the coughing, already. I think it’s a dead giveaway.” Kaufman replied, “I don’t know. Everyone seems to believe it.”

Early on, Kaufman told people he was dying because he “ate too much chocolate.” He had read a book called “Sugar Blues” that said that “too much chocolate can kill you.”

“Maybe I’ll just stick with cancer,” Kaufman said, after which Zmuda asked how long he planned to stay dead. He said, “If I was going to be a little boy about it, I’d go into hiding for one or two years. But if I was going to be a man about it, it’d be 20 or 30 years.”

Kaufman, Zmuda believes, found a “body double,” someone with his general physical appearance, who was genuinely dying of cancer. Then he began changing his own physicality to match that of the dying man, including losing weight and shaving his head, and released ­photos of himself in this state.

Zmuda says that once, when Kaufman’s brother Michael flew out to LA to visit his dying brother, Kaufman accidentally dropped the charade, appearing sick and frail one day but “back to his old self” the next. When Michael asked how it was possible, he was told, “medication.”

Zmuda and Kaufman came to privately refer to it as “the dying routine.” In one of their final conversations on the matter, Zmuda says, they discussed his financial situation, since as Kaufman’s writer, Zmuda’s career was built around Kaufman’s. Kaufman suggested leaving Zmuda money, but he said no, as it could implicate him when Kaufman returned.

By then, Zmuda claims, Kaufman had decided on 30 years as the time frame for his hoax and that he would keep Margulies out of the loop, letting her believe he had really died.

Even to Zmuda, who had helped create many of Kaufman’s deceptions, it all began sounding “pretty f- -ked up.”

“Bob, it’s who I am and what I do,” Kaufman said. “Nothing could ever top it. I’ve given it great thought. Besides, I’m getting psyched. I’m starting an entire new life.”

Asked how he would start that life given that the world knew what he looked like, Kaufman suggested becoming a children’s clown, which would allow him to wear makeup, and calling himself “something stupid like ‘Zany Clowny.’ ”

When the body double died, Zmuda says, a switch was made, with the double buried as Kaufman, and Kaufman being spirited away to start his new life.

Alternate theories

Co-author Margulies doesn’t seem to share Zmuda’s feelings on this, but offers an alternate theory of Kaufman’s passing.

Zmuda and Margulies reveal here for the first time that Kaufman was bisexual, and she floats the possibility that he died not of cancer but AIDS. The pair writes that Kaufman made them promise to keep his bisexuality a secret until both his parents were dead. Kaufman’s mother died soon after he did, and his father passed away last year.

While it has long been known that Kaufman was a sex addict — in just one week, Zmuda says, Kaufman had sex with all 42 women working at the Mustang Ranch brothel in Las Vegas — they recall that he would also pick up men for sex in San Francisco’s Castro District.

“Years after Andy ‘died,’ ” writes Margulies, “a gay friend in San Francisco said that everyone knew Andy died of AIDS because they saw him in the Castro District constantly.”

The book also reveals that ­comedian Dave Chappelle told Zmuda at the Aspen Comedy Festival in 2005 that his own infamous exit from comedy, when he walked out on his Comedy Central show, was directly influenced by Kaufman.

After being summoned to see the comic, writes Zmuda, Chappelle announced to the few people in the room: “Folks, listen up. It was because of this man and Andy Kaufman that I quit my job!”

Zmuda says he “winced” in response and asked, “I did?”

Chappelle then told Zmuda that “Chappelle’s Show” “just wanted me to keep that same old step-and-fetch-it bulls- -t going. I wasn’t going to do it! I don’t care how much they paid me. That show was killin’ me. Now I know how Andy was feeling having to do ‘Taxi.’ ”

A late return

Toward the end of the book, Zmuda recalls how at Kaufman’s funeral, he “didn’t shed a tear” but “had to bite my lip a few times to keep from exploding in laughter.” “Everyone was expecting Andy to jump out of the casket at any time,” he says.

Zmuda believes that, given Kaufman’s self-declared 30-year timeline, his return is imminent. Kaufman died in May 1984. If Zmuda is correct, then Kaufman is already late.

In the book’s final pages, Zmuda addresses Kaufman directly, imploring him to emerge and laying out plans for how it could be done, including Zmuda coordinating a massive event at which Kaufman would appear.

Discussing his longtime code of secrecy with Kaufman about their pranks, Zmuda writes: “The only reason I’m giving it up now is that Andy set a time limit on this one. Thirty years. So I’ve kept my part of the bargain and kept my mouth shut. But no more. The prank’s over. I want him back and he’s coming back.”