McCain, whom millions of Americans consider a war hero, died of brain cancer last summer, aged 81. Reportedly at the late Republican's request, Mr Trump was not invited to his funeral service at Washington National Cathedral.
“I endorsed him at his request, and I gave him the kind of funeral he wanted, which as president I had to approve,” Mr Trump told an audience of workers at an Ohio tank factory on Wednesday.
“I don’t care about this – I didn’t get thank you’d, that’s OK. We sent him on the way, but I wasn’t a fan of John McCain.”
It is unclear who Mr Trump was seeking thanks from.
The diatribe, which lasted almost five minutes and was largely met with silence, took in a range of perceived missteps by McCain, including his involvement in a dossier alleging links between Mr Trump and Russia and his vote against a Republican healthcare bill.
“So I have to be honest, I’ve never liked him much, hasn’t been for me, I’ve really probably never will, but there’s certain reasons for it and I’ll tell you, and I do this to save a little time with the press later on,” Mr Trump began.
“John McCain received a fake and phoney dossier, did you hear about the dossier? It was paid for by Crooked Hillary Clinton, right? And John McCain got it, he got it, and what did he do? He didn’t call me, he turned it over to the FBI hoping to put me in jeopardy, and that’s not the nicest thing to do.”
The dossier into Mr Trump’s connections to Russia, which was compiled by former MI6 officer Christopher Steele, was funded by a private intelligence firm on behalf of the Clinton campaign.
McCain, who was made aware of the dossier days after Mr Trump’s election in November 2016, passed its contents on a month later to then FBI chief James Comey.
Mr Trump continued: “John McCain campaigned for years to repeal and replace Obamacare … when he finally had the chance to do it he voted against repeal and replace, he voted against at 2 o’clock in the morning, remember thumbs down. We said ‘What the hell happened?’”
Mr Trump’s “thumbs down” complaint is a reference to when McCain in 2017 defied Mr Trump’s attempt to partially repeal former president Barack Obama’s healthcare reforms.
The senator voted against the bill, effectively killing the so-called “skinny” repeal, which would have resulted in 16 million people losing their health insurance.
The president also falsely claimed McCain "didn't get the job done" on a healthcare programme for veterans called the Veteran's Choice Act. Mr Trump instead said, "I got it done", despite the fact McCain was the author of the bill, which came into law in 2014.
Mr Trump was merely president when Congress last year passed a new version of the programme.
His outburst is just the latest in a series of attacks against McCain in recent days. Earlier this week, the president described McCain’s Obamacare no-vote as “disgraceful”, and over the weekend falsely claimed on Twitter McCain finished “last in his class” at the US Naval Academy in Annapolis.
So it was indeed (just proven in court papers) “last in his class” (Annapolis) John McCain that sent the Fake Dossier to the FBI and Media hoping to have it printed BEFORE the Election. He & the Dems, working together, failed (as usual). Even the Fake News refused this garbage!— Donald J. Trump (@realDonaldTrump)March 17, 2019
Although the pair repeatedly clashed during and after the 2016 presidential campaign, Mr Trump's continued jibes even after death has drawn criticism from both lawmakers and McCain’s family.
The late senator’s daughter, Meghan McCain, on Wednesday said of her father: “He would think it was hilarious that our president was so jealous of him, that he was dominating the news cycle in death as well.”