Rudy Giuliani on Wednesday denied asking former Gov. George Pataki to cancel the 2001 mayoral election so he could stay in office following the Sept. 11 terror attacks — calling the claim “bulls–t” that Pataki is using “to sell a book.”

“I did not ask George to extend my term. Absolutely not! I never asked him to do it,” Giuliani told The Post.

“It’s bulls–t. George is looking to sell a book about something that didn’t happen.”

Giuliani also said he’s “really surprised at George,” adding that, “I thought he was a friend” and that Pataki “should be ashamed of himself.”

“No. 1, even if it was true, he betrayed a private conversation,” Giuliani said.

“No. 2, it didn’t happen.”

Giuliani’s remarks came in response to an exclusive Post report on Pataki’s upcoming Sept. 11 memoir, in which the three-term Republican governor claims that Giuliani approached him on Sept. 24, 2001, and asked him to cancel the upcoming general election.

“Governor, you have the power to change the city charter to allow for me, as mayor in this time of crisis, to have an extended term,” Giuliani said, according to Pataki.

Giuliani wouldn’t drop the issue when Pataki refused, but later relented and admitted, “George, you are right. I don’t think you should cancel the election,” Pataki writes in “Beyond the Great Divide: How A Nation Became A Neighborhood,” which goes on sale April 14.

Pataki also claims that Giuliani made his request out of desperation when an “off-the-radar public relations campaign” by his team failed to “influence lawmakers through the media.”

Giuliani told The Post that his advisers and other supporters “floated the idea for two days,” but that “I never made the decision to do it. I didn’t do it. I didn’t like the idea.”

Giuliani tried to get the candidates seeking to succeed him to agree to extend his term by three months, telling the “Imus in the Morning” syndicated radio show on Sept. 28, 2001, that it would satisfy both the New Yorkers who wanted him to remain in office and those who wanted him to leave on schedule.

“The best way to accommodate both of those things is create a longer transition period,” Giuliani said.

That plan never came to fruition, however, and Michael Bloomberg — who ran as a Republican to narrowly beat Democrat Mark Green, and is now running for president as a Democrat — was sworn in as the city’s 108th mayor on Jan. 1, 2002.