The president said the story, first reported in The Atlantic, is “totally false”.
A senior Defence Department official with first-hand knowledge of events and a senior Marine Corps officer who was told about Mr Trump’s comments confirmed some of the remarks to the Associated Press, including the cemetery incident.
The officials said he made the comments as he begged off visiting the cemetery outside Paris during a meeting following his presidential daily briefing on the morning of November 10 2018.
What animal would say such a thing?
Staff from the National Security Council and the Secret Service told Mr Trump that rainy weather made helicopter travel to the cemetery risky, but they could drive there. He responded by saying he did not want to visit the cemetery because it was “filled with losers”, the official said.
At the time the White House blamed the cancelled visit on poor weather.
In another conversation on the trip, The Atlantic said, Mr Trump referred to the 1,800 marines who died in the First World War battle of Belleau Wood as “suckers” for getting killed.
He denied the Atlantic report, calling it “a disgraceful situation” by a “terrible magazine”.
Speaking to reporters after he returned to Washington from a campaign rally in Pennsylvania, Mr Trump said: “I would be willing to swear on anything that I never said that about our fallen heroes. There is nobody that respects them more. No animal — nobody — what animal would say such a thing?”
He also reiterated the White House explanation of why he did not visit the cemetery. “The helicopter could not fly,” he said, because of the rain and fog.
“The Secret Service told me you can’t do it. They would never have been able to get the police and everybody else in line to have a president go through a very crowded, very congested area.”
White House chief of staff Mark Meadows said: “It’s sad the depths that people will go to during a lead-up to a presidential campaign to try to smear somebody.”
Democratic presidential candidate Joe Biden, whose son served in Iraq, said: “If the revelations in today’s Atlantic article are true, then they are yet another marker of how deeply President Trump and I disagree about the role of the president of the United States.
“Duty, honour, country — those are the values that drive our service members. I will ensure that our American heroes know that I will have their back and honour their sacrifice — always.”
The defence officials also confirmed to the AP that Mr Trump, on Memorial Day 2017, had gone with chief of staff John Kelly to visit the Arlington Cemetery gravesite of Mr Kelly’s son Robert, who was killed in 2010 in Afghanistan, and said to Mr Kelly: “I don’t get it. What was in it for them?”
The senior Marine Corps officer and The Atlantic, citing sources with first-hand knowledge, also reported that Mr Trump said he did not want to support the August 2018 funeral of Republican senator John McCain, a decorated navy veteran who spent years as a Vietnam prisoner of war, because he was a “loser”.
The Atlantic reported that the president was angered that flags were flown at half-mast for Mr McCain, saying: “What the f*** are we doing that for? Guy was a f****** loser.”
Trump acknowledged Thursday he was “never a fan” of McCain and disagreed with him, but said he still respected him and approved everything to do with his “first-class triple-A funeral” without hesitation because “I felt he deserved it.”
In 2015, shortly after launching his presidential candidacy, Mr Trump publicly criticised Mr McCain, saying: “He’s not a war hero,” and adding:: “I like people who weren’t captured.”
The magazine said Mr Trump also referred to former president George HW Bush as a “loser” because he was shot down by the Japanese as a Navy pilot in the Second World War.