Donald Trump and Hillary Clinton roasted each other Thursday night at a ritzy Manhattan gathering of political and business heavyweights. Both elicited laughs and a smattering of boos when they broke from the event’s tradition of good-humored jesting and zinged each other with a few pointed barbs.

Trump spoke first during the 71st annual Alfred E. Smith Memorial Foundation Dinner, a rite-of-passage for presidential candidates of both major parties sponsored by Archdiocese of New York to benefit Catholic children’s charities.

After a few relatively tame jokes aimed at Clinton and others at the Waldorf Astoria dinner, Trump referenced the recent spate of her apparent emails released by WikiLeaks.

“Here she is tonight in public, pretending not to hate Catholics,” Trump said, a nod to what WikiLeaks said were excerpts of emails, including one about a high-dollar, closed-door Wall Street speech in which Clinton admits to differing private and public positions, and another where a top Clinton aide says Catholics think they are the “most socially acceptable politically conservative religion.”

The dig at Clinton set off a loud chorus of boos and momentarily derailed the good-natured mood at the dinner.

Clinton was more self-deprecating in her remarks before an affluent audience.

advertisement | advertise on newsday

“Usually, I charge a lot for speeches like this,” she told the gathering, which included New York City Mayor Bill de Blasio and Gov. Andrew M. Cuomo.

But Clinton also had barbs saved for Trump that drew a smaller but still-audible round of boos from some. She gave him a dig for his refusal at Wednesday’s debate to commit to accepting the results of the Nov. 8 election.

“It’s amazing I am up here after Donald,” Clinton said, as Trump sat a few feet away between Cardinal Timothy Dolan and the billionaire’s wife, Melania. “I didn’t think he would be OK with a peaceful transition of power.”

The presidential nominees shared the stage for what will perhaps be the last time before Election Day, separated on the dais only by the commanding presence of Dolan, who sat between them. Dolan, in his later remarks, noted that he felt a cold coming on, jokingly blaming his seat between the two candidates which he called “probably the iciest place on the planet. Where is global warming when you need it?”

The white-tie affair has traditionally been intended as a night of levity amid politically charged campaigns, and in this year’s case, one that has been invective-laced.

Four years ago, President Barack Obama and Republican presidential candidate Mitt Romney earned the biggest laughs with self-deprecating lines. Obama made fun of his middle name, Hussein, and Romney joked about his wealth.

Al Smith IV, master of ceremonies and great-grandson of the late former Gov. Al Smith after whom the dinner is named, opened Thursday night’s proceedings by referencing the leaked audio from 2005 in which Trump makes lewd sexual comments about women. The candidate has defended the remarks as “locker room talk.”

“Even though there’s a man sitting next to you in a robe, you’re not in a locker room,” Smith joked to Trump as Dolan broke into a guffaw.

advertisement | advertise on newsday

Clinton also joked about Trump’s statements referencing women and their appearances, as well as his disparaging statements about immigrants.

“Donald looks at the Statue of Liberty and sees a 4,” she said, “maybe a 5 if she loses the torch and tablet and changes her hair.”

Clinton also made fun of Trump’s compliments toward the Russian Federation’s leader.

“Donald really is healthy as a horse, you know, the one Vladimir Putin rides around on,” she said.

Before he started speaking about the WikiLeaks findings that Clinton’s campaign has said came from emails hacked by Russia, Trump earned broad laughs when he spoke about what he has said was the news media’s favorable treatment of Democrats.

advertisement | advertise on newsday

“Michelle Obama gives a speech and everyone loves it. . . . My wife Melania gives the exact same speech and people get on her case, and I don’t get it,” Trump said.

Melania Trump’s Republican National Convention speech had echoes of a speech given eight years earlier by the First Lady.

The former secretary of state and real estate mogul didn’t acknowledge each other as they were introduced, but appeared to chat briefly after they were seated, leaning over Dolan.

Both were applauded by the crowd of 1,500 when they entered.

Supporters of Clinton on the dais included former Mayor Michael Bloomberg and Sen. Chuck Schumer. Among the Trump backers were former Mayor Rudy Giuliani, who scrunched his face in displeasure at several of Clinton’s lines.

The presidential hopefuls attended the roast fewer than 24 hours after an acerbic final debate. Trump modified his stance on the election results earlier Thursday at a rally in Delaware, Ohio, saying he would accept the outcome “if I win.”