An overview of attendees of the 72nd Annual Alfred E. Smith Dinner at the New York Hilton Midtown.

House Speaker Paul Ryan lampooned President Trump at a charity dinner Thursday night, mocking his Twitter habits, his former top adviser Steve Bannon and his Big Apple roots.

Ryan, who appeared as the keynote speaker at the 72nd Al Smith Dinner, didn’t single out the president — he made lighthearted jibes at Sen. Chuck Schumer, Cardinal Timothy Dolan and disgraced former Rep. Anthony Weiner — but reserved most of his joking for the commander-in-chief.

“Cardinal Dolan gave a benediction at President Trump’s inaugural,” said the Wisconsin Republican in the windup to one gag. “There was just this one kind of awkward moment when the cardinal talked about the infallible, enlightened supreme being. The president stood up and took a bow.”

Trump made huge waves at last year’s dinner — traditionally an entertaining soiree held to raise money for needy children and honor the legacy of the first Catholic presidential nominee — when he suggested his co-keynote and presidential rival Hillary Clinton hated Catholics and tarred her as “so corrupt.”

Ryan, who appeared in tails at the white-tie affair at the Midtown Hilton, didn’t miss the opportunity to make light of last year’s gaffe-filled affair.

“I know last year that Donald Trump offended some people. I know his comments, according to critics, went too far,” he said. “Some said it was unbecoming of a public figure, and they said that his comments were offensive. Well, thank God he’s learned his lesson.”

Like Trump last year, Ryan also played with the idea that press coverage of the event would be slanted, but included what Trump’s Twitter response to his remarks Thursday dinner would be.

“The president will tweet, ‘300,000 at Al Smith dinner cheer mention of my name,’” Ryan said while mimicking typing into a phone.

He described 66-year-old Schumer as part of the Democratic Party’s “youth movement,” mocked Bannon’s diss of him that he was born in a Heritage Foundation petri dish, and said he hadn’t seen so many New York liberals since his last visit to the White House.

He mocked Trump, Weiner and Sen. Ted Cruz for their late-night Twitter antics.

Ryan has been on the receiving end of attacks by Trump, who accused him in August of making a “mess” of the debt-ceiling negotiations in Congress. The speaker has been relatively gentle in his own critiques, but has offered them from time to time.

In August, Ryan criticized Trump’s controversial remarks blaming “many sides” for the white supremacist demonstrations in Charlottesville that left one woman dead, saying the president “messed up.”

Outside the party Thursday night, demonstrators had another sort of roast in mind for Ryan, who they demanded help pass the DREAM Act, which would grant residency to undocumented minors living in the US.

They chanted and held signs emblazoned with the words: “Paul Ryan White Supremacist” and “Rise and Resist.”

“He’s not supporting the rights of immigrants who have been in the country practically their whole lives,” said Elise Nakhaikian, a protester who would like to see the proposal passed without a provision to build a border wall.

Mayor Bill de Blasio, former Mayor Michael Bloomberg and Gov. Andrew Cuomo also attended the event, and while Bloomberg and Cuomo were both introduced to applause, de Blasio was greeted with boos and scattered clapping.