Susan E. Rice, the U.S. ambassador to the United Nations who lost out in a bruising bid for the job of secretary of state, may have the last laugh.

Rice has emerged as far and away the front-runner to succeed Thomas E. Donilon as President Obama’s national security adviser later this year, according to an administration official familiar with the president’s thinking. The job would place her at the nexus of foreign-policy decision making and allow her to rival the influence of Secretary of State John F. Kerry in shaping the president’s foreign policy.

The appointment would mark a dramatic twist of fortune for Rice, whose prospects to become the country’s top diplomat fizzled last year after a round of television appearances in which she provided what turned out to be a flawed account of the Sept. 11 terrorist attack on the U.S. diplomatic mission in Benghazi, Libya.

That episode ignited a firestorm of criticism from Senate Republicans, who questioned her honesty and vowed to oppose her nomination and exposed misgivings from more liberal detractors who questioned whether her temperament, her family’s investments and her relations with African strongmen made her unfit to lead the State Department.

In plotting her political rehabilitation, Rice has kept whatever disappointment she may have felt in check, employing humor to blunt the indignity of the experience.

At the same time, her staff has sought to erect a more protective shield around her, moving to restrict access by mid-level foreign delegates suspected of leaking details about her more controversial positions and sometimes undiplomatic remarks in confidential deliberations at the United Nations.

Last month, Rice marked her reentry onto the national political stage with an appearance on Comedy Central’s “Daily Show” with Jon Stewart, a sympathetic host who denounced the “malevolence” of her Republican critics and urged her to respond with her trademark cussing. “What would you say to them?” he asked. “And feel free to talk like a sailor.”

In December, just days after she withdrew her name from consideration for secretary of state, Rice made a showing at the U.N. Correspondents Association annual ball, where she assured U.N.-based reporters and diplomats she was not disappointed to be sticking around the United Nations for a while longer. “There is no place in the world I’d rather be tonight,” she said. The punch line appeared on a screen behind her: a picture of the State Department.

Rice made light of reporting highlighting her support for controversial African leaders, including Rwandan President Paul Kagame, whose government stands accused of backing a brutal insurgency in the neighboring Democratic Republic of the Congo: “I’m amazed by some of the work you do — absolutely incredible. Some of you have been able to uncover things about me that I didn’t even know about myself. Seriously, even I didn’t know that I once lost a human-heart-eating contest to Idi Amin.”

Rice, 48, has largely fallen below the media’s radar, but her standing within the Obama administration remains secure, according to White House officials and Democratic lawmakers. Her U.N. colleagues are betting she will ultimately serve as Obama’s national security adviser, probably sometime after the United States assumes the rotating presidency of the U.N. Security Council in July.

“I think that Susan always maintains close relations with the president and his national security team, and that continues to be the case,” said Ben J. Rhodes, the spokesman for the National Security Council. “If anything, the way she handled the Benghazi situation — and then the withdrawal — only enhanced her relations here, because she did so with grace and good humor.”

Democratic lawmakers said they believe the controversy over Benghazi has largely subsided. The post of national security adviser does not require Senate confirmation, giving the president wider scope to appoint whomever he wants.

“I think people have moved on with Benghazi as it relates to Susan Rice,” said Rep. Eliot L. Engel (N.Y.), the ranking Democrat on the House Foreign Affairs Committee. “In the general course of events, it has not weakened her at all. I think the president has confidence in her, and she serves at the pleasure of the president.”

Several Republican lawmakers, including Sens. John McCain (Ariz.) and Lindsey O. Graham (S.C.), who previously made clear their opposition to Rice as secretary of state, did not respond to requests for comment for this article. Other conservative critics suggested the stain of the Benghazi remarks — in which Rice suggested the attack appeared to have grown out of a “spontaneous” protest over an ­anti-Muslim video — endures.

“I suspect that Ambassador Rice will never recover from her performance on Benghazi,” said Danielle Pletka, vice president for foreign and defense policy studies at the American Enterprise Institute. “Luckily she’s a young woman, and there will be future administrations. But in this one, I suspect she’s not going to go anywhere that requires confirmation.”

At the United Nations, Rice — who is set to become the longest-serving U.S. ambassador to the United Nations since Henry Cabot Lodge Jr., who served from 1953 to 1960 — has continued to plow ahead, overseeing U.S. efforts to negotiate two sanctions resolutions on North Korea.

If the battle has left scars, her colleagues say they have not shown.

“Absolutely, chin up, raring to go,” said Hardeep Singh Puri, India’s U.N. ambassador. “She’s been very circumspect. The fact that something went wrong on this Benghazi matter is neither here nor there. The fact is that she is meant for big things.”

Diplomats say Rice’s bruising experience has not made her any softer, particularly in the case of a string of recent leaks.

After the disclosure of her opposition to sanctions against Rwanda, the United States lodged a complaint with France over suspicions of leaking and informed French officials that lower-level experts would not be allowed into meetings with Rice, according to Security Council diplomats. Her office also instructed the United Nations to restrict attendance to closed-door consultations of the Security Council after a leak detailing Rice’s support for a U.N. peacekeeping mission in Mali.

Rice declined to be interviewed for this article. Her spokeswoman, Erin Pelton, said: “Under Ambassador Rice, the United States negotiates privately and in good faith with our Security Council colleagues. We don’t leak the contents of often sensitive meetings because we don’t want to undermine the integrity and effectiveness of the negotiations.”

One council diplomat, describing Rice’s recent scrapes with other diplomats, said she remains “combative.” Rice herself is all too aware of such characterizations.

“People have called me brusque, aggressive, abrasive,” she joked at the U.N. correspondents ball. “Of course, they don’t say that to my face, because they know I’d kick their butts.”