Nikki R. Haley joked about President Trump’s braggadocio in his United Nations speech last month. Once, she said, he asked if she belonged to the same Native American tribe as Senator Elizabeth Warren. And as a member of Mr. Trump’s cabinet, she added, “It is a thrill to be out to dinner without being harassed.”
For about 17 minutes Thursday night in the New York Hilton ballroom, Ms. Haley, Mr. Trump’s soon-to-be-leaving ambassador to the United Nations, tried her hand at one-liners before a crowd of 700 guests at the annual Al Smith charity dinner, a high-powered event of the political and Roman Catholic elite hosted by Cardinal Timothy M. Dolan.
It was a sort of let-loose opportunity for Ms. Haley, 46, a Republican star who is widely thought to have presidential ambitions — although she has dismissed the idea of running against Mr. Trump, with whom she appears to have a good relationship.
Still, it remains unclear precisely why Ms. Haley is leaving her United Nations post after less than two years, and her monologue did nothing to provide answers.
But she joked about it. Having breakfast with Cardinal Dolan a few weeks ago to prepare for her speech, she told the crowd, “I asked, ‘Was there anything I could do to really boost attendance?’ And he said, ‘Why don’t you resign as U.N. ambassador?’”
Ms. Haley said the president also called her with some advice.
“Just brag about my accomplishments,” she quoted him as recommending. “It really killed at the U.N., I’ve got to tell you.”
Ms. Haley is the daughter of immigrants from India, who grew up in the South and became South Carolina’s first female governor and first minority governor. She had a little fun with that, too.
When the president first learned of her Indian heritage, she said, “He asked me if I was from the same tribe as Elizabeth Warren,” the Democratic senator from Massachusetts who may challenge Mr. Trump in 2020. He has ridiculed Ms. Warren’s claims of Native American ancestry.
The benefit of growing up as an Indian-American who experienced discrimination in South Carolina, Ms. Haley said, was that it “totally prepared me for being a Republican in New York.”
Ms. Haley also chided The New York Times for an article last month that left the misimpression that the Trump administration had spent more than $52,000 on curtains for her diplomatic residence. The curtains had been ordered by the Obama administration. (The Times corrected the article to make that clear.)
But Ms. Haley wasn’t satisfied. She joked that the newspaper had merely “changed the headline to ‘Obama Creates High-Paying Jobs in the Curtain Industry.”
Ms. Haley also complained about other fake headlines, including one that said the rapper Kanye West had been sworn in as her replacement. “Oh wait, that could really happen,” she said.
Ms. Haley was introduced as guest speaker by the dinner’s master of ceremonies, the comedian Jim Gaffigan, who said, “It’s amazing how Nikki Haley has exited this administration with such dignity.”
Seated on the three-tiered dais in the Hilton ballroom, Ms. Haley and her husband, Michael, were surrounded by powerful figures in New York government, finance, media, real estate and philanthropy. They included Gov. Andrew M. Cuomo, Mayor Bill de Blasio, former Mayor Michael R. Bloomberg, Senator Chuck Schumer, former Secretary of State Henry A. Kissinger, the Wall Street financier Stephen A. Schwarzman and the television journalists Maria Bartiromo of Fox News and Jeff Glor of CBS News.
The keynote address by Ms. Haley was the first high-profile New York appearance she has made outside the United Nations since she announced last week that she was resigning the ambassador’s post at year’s end.
Her notice, which took many White House officials by surprise, immediately stirred recurrent speculation that Ms. Haley might run for office again and possibly even challenge Mr. Trump. But Ms. Haley emphatically denied such a prospect when she appeared with the president at the White House on Oct. 9 to formally announce her resignation.
On the contrary, Ms. Haley said she intended to campaign for Mr. Trump’s re-election. And Mr. Trump said he hoped she would return to work for him.
Despite her assurances of fealty to the president, Ms. Haley’s departure from the administration will enable her to distance herself from any setbacks that may be suffered by the Republicans in the November midterm elections, which are less than three weeks away.
Coming into the job with little diplomatic experience, Ms. Haley has nonetheless been something of a foreign policy star in the Trump administration and one of its few prominent women. She has been seen as a steady voice in the midst of White House turnover and dysfunction.
The annual Alfred E. Smith Memorial Foundation dinner, as it is formally known, has evolved into a prominent political showcase over its seven decades.
Its keynote speakers have included presidents, presidential candidates and diplomatic and cultural figures like Winston Churchill, Tony Blair, John F. Kennedy and Bob Hope.
The speakers often serve up self-deprecating jokes, coupled with messages of morality and the charitable work of the foundation, which this year raised nearly $4 million for Catholic children’s charities.