President Trump said Thursday night on Fox News that doctors who administered him a recent cognitive test were “very surprised” that he “aced” it, continuing a long-standing preoccupation with defending his mental acumen as critics constantly question his fitness for office.

In a live phone interview with Fox News host Sean Hannity, Trump bragged about his test score on a cognitive exam at Walter Reed National Military Medical Center after Hannity invoked presumptive Democratic nominee Joe Biden, asking the president whether he believed Biden had the “mental alertness” to be president.

Trump said he didn’t think the Democrat could pass the cognitive exam like he did.

“I actually took one very recently when, you know, the radical left was saying, ‘Is he all there? Is he all there?’ I proved I was all there, because I aced it,” Trump told Hannity. “I aced the test. … He should take the same exact test, a very standard test. I took it at Walter Reed Medical Center in front of doctors and they were very surprised. They said, ‘That’s an unbelievable thing. Rarely does anyone do what you just did.’ ”

It’s unclear exactly to what cognitive test Trump was referring in the interview. The most recent publicly disclosed cognitive test Trump took at Walter Reed was in January 2018, when the White House’s top physician said he got a perfect score. The exam Trump took then was the Montreal Cognitive Assessment, which is designed to detect mild cognitive issues, largely in older people. The 10-minute exam asks patients to identify animals in pictures, draw a clock, and perform basic word-recall exercises.

The White House did not immediately respond to a request for comment clarifying whether Trump has taken another test more recently.

Along with jabs at Biden, Trump’s latest Hannity interview also covered the Sun Belt coronavirus hot spot, Trump’s willingness to wear a mask in an upcoming public appearance and the Black Lives Matter street slogan in New York that Mayor Bill de Blasio (D) helped paint, which Trump derided.

As the U.S. surpasses 3 million cases, The Post's Lenny Bernstein talks about what we know about the virus and why it is incredibly harmful to some patients. (The Washington Post)

His comments about the cognitive test are part of a pattern of attacks on Biden’s mental acuity while aggressively defending his own. As The Washington Post reported last month, Trump’s preoccupation with projecting an image of intelligence and physical strength has intensified in recent months after critics mocked him for episodes such as shuffling cautiously down a ramp and slowly drinking a cup of water with both hands.

At his campaign rally in Tulsa last month, for example, he spent more than 14 minutes explaining why he was moving slowly down the ramp and the water-drinking incident. At a White House Cabinet meeting in June, Trump again spoke about his performance on the Montreal Cognitive Assessment more than two years earlier, people familiar with Trump’s comments told The Post last month.

In an election between Trump, 74, the oldest president to enter office, and Biden, 77, who would break Trump’s record, questions about age and cognitive function have followed both of them on the campaign trail. The Trump campaign released an ad last month capitalizing on Biden’s gaffes, saying that he “does not have the strength, the stamina and mental fortitude required to lead this country.” The Biden campaign has turned the attacks back on Trump, saying last month, “For someone so obsessed with appearing strong, Donald Trump shows us every day just how weak he is.”

When Biden was asked by a reporter at a Wilmington, Del., news conference late last month whether he had been tested for cognitive decline, Biden said yes and that he is “constantly” tested.

“Look, all you’ve got to do is watch me, and I can hardly wait to compare my cognitive capability to the cognitive capability of the man I’m running against,” he said.

Trump, who has refused to wear face masks in public appearances, has also sometimes poked fun at Biden for wearing a face mask.

But on Thursday night, Trump said that “it’s fine to wear a mask if you feel comfortable.” He added that he would wear one on an upcoming visit to Walter Reed in Bethesda — not to take a cognitive test but to visit with soldiers and medical staff. He said he considers a hospital an “appropriate setting” to wear a mask.

“I don’t want to spread anything,” he told Hannity of his decision to wear one at Walter Reed. “And a lot of it is you spreading, not them spreading. I don’t want to cause a problem for anybody. I have no problem with masks. But it’s got to be done at the right time.”

Trump has stubbornly refused to publicly encourage Americans to wear masks, and on Hannity’s show, he suggested that they are good for “certain circumstances,” such as hospitals. He continued to mock Biden for wearing one during campaign appearances until speaking. “Then he takes it off,” Trump said. “He likes to have it hang off, usually, the left ear.”

The revelation that Trump would don a face mask at Walter Reed came during a discussion about coronavirus testing. Trump threw his experts, namely Anthony S. Fauci, director of the National Institute of Allergy and Infectious Diseases, under the bus on that issue, saying that “a lot of mistakes were made,” while sidestepping blame. And he again politicized testing, saying the increase in coronavirus cases is “the greatest thing that ever happened for the opposite party.”

States including Arizona, Florida and Texas have seen dramatic increases since mid-June, as the United States surpassed 3 million infections this week, with more than 130,000 dead.