UNITED NATIONS – 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 Tom 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 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 following a round of television appearances in which she provided what turned out to be a flawed account of a 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.

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 midlevel 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 respond with her trademark cussing.

“What would you say to them?” he asked. “And feel free to talk like a sailor.”