WASHINGTON — One by one, they praised President Trump, taking turns complimenting his integrity, his message, his strength, his policies. Their leader sat smiling, nodding his approval.

“The greatest privilege of my life is to serve as vice president to the president who’s keeping his word to the American people,” Mike Pence said, starting things off.

“I am privileged to be here — deeply honored — and I want to thank you for your commitment to the American workers,” said Alexander Acosta, the secretary of labor.

Sonny Perdue, the agriculture secretary, had just returned from Mississippi and had a message to deliver. “They love you there,” he offered, grinning across the antique table at Mr. Trump.

Reince Priebus, the chief of staff whose job insecurity has been the subject of endless speculation, outdid them all, telling the president — and the assembled news cameras — “We thank you for the opportunity and the blessing to serve your agenda.”

So it went on Monday in the Cabinet Room of the White House, as Mr. Trump transformed a routine meeting of senior members of his government into a mood-boosting, ego-stroking display of support for himself and his agenda. While the president never explicitly asked to be praised, Mr. Pence set the worshipful tone, and Mr. Trump made it clear he liked what he heard.

“Thank you, Mick,” he told Mick Mulvaney, his budget director. “Good job,” he told Scott Pruitt, his E.P.A. chief. “Very good, Daniel,” he said to Dan Coats, the director of national intelligence.

The commander in chief, who has been known for decades as a fan of flattery and who speaks of himself in superlatives, even indulged in a bit of self-congratulation. He declared himself one of the most productive presidents in American history — perhaps Franklin D. Roosevelt could come close, he conceded — and proclaimed that he had led a “record-setting pace” of accomplishment.

Never mind that Mr. Trump has yet to sign any major legislation, or that his White House has been buffeted by legal and ethical questions surrounding the investigation into his campaign’s possible links to Russia and his firing of the F.B.I. director who had been leading that inquiry.

The highly unusual spectacle before the cabinet meeting got down to business and the TV cameras were banished seemed designed to deflect attention from the president’s faltering agenda and the accusations leveled against him last week by the fired F.B.I. director, James B. Comey, which are threatening to further overshadow his agenda and haunt his presidency.

Days before, Mr. Comey had charged that Mr. Trump had lied about his firing and inappropriately sought to influence the Russia investigation. On Monday, the president said the country was “seeing amazing results” from his leadership.

“I will say that never has there been a president, with few exceptions — in the case of F.D.R. he had a major Depression to handle — who’s passed more legislation, who’s done more things than what we’ve done,” Mr. Trump said. “We’ve been about as active as you can possibly be, and at a just about record-setting pace.”

The tableau in the Cabinet Room drew instant derision from critics. And within hours, Democrats had pounced.

In a video posted with the tweet, Senator Chuck Schumer, Democrat of New York and the minority leader, sat at a table with young staff members who, at his prompting, praised his performance on Sunday talk shows and the appearance of his hair. One repeated Mr. Priebus’s quotation word for word, prompting the senator and his aides to erupt into laughter.

Mr. Trump has been struggling with his legislative agenda. His effort to repeal and replace the Affordable Care Act passed the House on a second try, but senators are toiling to put together their own version. And his administration is months away from unveiling either a major tax cut package or the sweeping infrastructure plan he has promised.

The endorsements from the administration’s highest officials may have served as a comforting counterpoint to Mr. Trump’s sinking poll numbers. Fifty-nine percent disapprove of the job he is doing as president, according to a June 11 Gallup tracking survey, with only 36 percent approving.

After his upbeat introductory remarks on Monday, the president went around the table asking for a statement from each cabinet member. One by one, they said their names and — as if working to outdo one another — paid homage to Mr. Trump, describing how honored they were to serve in his administration.

“Thank you for the opportunity to serve at S.B.A.,” said Linda McMahon, the administrator of the Small Business Administration, trumpeting “a new optimism” for small businesses.

Ben Carson, the housing secretary, called it “a great honor” to work for Mr. Trump, while Mr. Perdue offered congratulations for “the men and women you have gathered around this table.”

Steven Mnuchin, the Treasury secretary, told Mr. Trump, “It was a great honor traveling with you around the country for the last year, and an even greater honor to be here serving on your cabinet.”

A few cabinet members diverged from the apparent script. Jim Mattis, the secretary of defense — whose reputation for independence has been a comfort to Mr. Trump’s critics — refrained from personally praising the president, instead aiming his comments at American troops fighting and dying for their country.

“Mr. President, it’s an honor to represent the men and women of the Department of Defense, and we are grateful for the sacrifices our people are making in order to strengthen our military so our diplomats always negotiate from a position of strength,” Mr. Mattis said as Mr. Trump sat, stern-faced.

But the meeting still struck White House officials of past administrations as odd.

The show of support for the president was in keeping with an intense effort by the White House to boost Mr. Trump’s mood and change the subject from Mr. Comey’s damaging testimony last week.

In a television interview on Monday morning, the president’s daughter Ivanka Trump said her father “felt vindicated” and was eager to move on and talk about the rest of his agenda. Appearing on “Fox & Friends,” she said that “he feels incredibly optimistic.”

Reporters who witnessed the cabinet meeting’s prelude tried in vain to ask the president about his comments about Mr. Comey — specifically, whether he has tapes of their conversations, as he has hinted.

But Mr. Trump was in no mood to allow such questions to rain on his parade, and he dismissed the news media with a curt “thank you.”

“Finally held our first full @Cabinet meeting today,” he tweeted later, along with a video of the meeting-turned-pep-rally. “With this great team, we can restore American prosperity and bring real change to D.C.”