President Trump on Saturday brushed off charges that Russia interfered in the 2016 election, implying that he would take Vladimir Putin’s word on the matter more seriously than the opinions of some US intelligence officials — but then backtracked a few hours later.

“They’re political hacks,” Trump remarked at a press conference on Air Force One in Vietnam of former CIA Director John Brennan, former Director of National Intelligence James Clapper and former FBI Director James Comey, who have all said evidence of Russian meddling is clear.

“You have Brennan, you have Clapper, and you have Comey. Comey’s proven now to be a liar, and he’s proven to be a leaker. So you look at that,” Trump said.

“And you have President Putin very strongly, vehemently says he had nothing to do with that.”

But later, early Sunday morning, at another press conference in Hanoi, Trump revised his comments, saying that he’s actually “with our agencies” and implied he’d appeared to agree with Putin to avoid a public argument while news cameras were rolling.

It’s not that he believes there was no meddling, Trump assured, but merely that he thinks Putin believes his own denial.

“What I said there is that I believe he believes that, and that’s very important for somebody to believe,” Trump stated during a joint press conference with Tran Dai Quang, the Vietnamese leader. “I believe that he feels that he and Russia did not meddle in the election.

“As to whether I believe it or not, I’m with our agencies, especially as currently constituted with their leadership,” he said.

Trump and the Russian president had spoken informally Saturday in a side meeting of the Asia-Pacific Economic Cooperation summit in Hanoi, a gathering of 21 world leaders.

At one point, the two were seen walking together down a path, conversing easily, with Putin smiling and Trump gesturing.

“He said he didn’t meddle. I asked him again,” Trump had said at first aboard Air Force One after the summit meeting concluded.

“You can only ask so many times. But I just asked him again, and he said he absolutely did not meddle in our election.”

Trump even speculated that the fact the meddling became public was evidence against Russian involvement.

“You know, there are those that say, if he did do it, he wouldn’t have gotten caught,” Trump said.

But throughout the day, he fell short of saying he believed Putin implicitly.

“Well, look, I can’t stand there and argue with him,” Trump said.

“I’m not looking to stand and start arguing with somebody when there’s reporters all around and cameras recording and seeing our conversation,” he said at the news conference with Quang.

The president has repeatedly warned that continued focus on the election allegations could damage relations with Russia and jeopardize American diplomatic efforts in Syria, North Korea and elsewhere.

It was a theme he repeated early Sunday — even implying that sanctions against Russia are too high.

“You know, people don’t realize Russia’s been very, very heavily sanctioned,” he said.

“It’s now time to get back to healing a world that was shattered and broken. Those are very important things.

“And I feel that having Russia in a friendly posture as opposed to always fighting with them is an asset to the world and an asset to our country.”

Back in Washington, CIA Director Mike Pompeo said his agency “stands by” the US intelligence community’s report concluding that the Russians made attempts to influence the 2016 presidential campaign in Trump’s favor.

And Arizona Sen. John McCain slammed Trump over the issue.

“There’s nothing ‘America First’ about taking the word of a KGB colonel over that of the American intelligence community,” said McCain , a strong Trump critic. Putin was a KGB officer in the former Soviet Union before entering Russian politics.

Trump’s assessment of Putin did not weigh in on whether the American president’s election campaign was involved in the Russian interference effort or had knowledge of it — a question that is under investigation by special counsel Robert Mueller.

Trump said that during the summit meeting — which offered almost no access to the American press — he and Putin “spoke ­intermittently.”

“And I think it’s a shame that something like that can destroy a very important potential relationship between two countries that are very important countries,” he said of the meddling controversy.

“Russia could really help us. And the Democrats wanted to have a good relationship with Russia, but they couldn’t do it because they didn’t have the talent to do it. They didn’t have the chemistry to do it. They didn’t have what it takes to do it.”

He lambasted former President Barack Obama and Hillary Clinton, and said the former secretary of state had been in “way over her head” when it came to negotiating with Putin and his regime.

“Hillary tried it, and she failed. . . . She did that reset button; it was a joke. But she tried and she failed,” he said.

“Obama tried and he failed. Couldn’t have it, because he didn’t have chemistry. They didn’t have the right chemistry.”

Not so with Trump and Putin.

“We seem to have a very good feeling for each other and a good relationship considering we don’t know each other well. I think it’s a very good relationship,” he said.

The pair’s chats led to a formal joint statement, issued Saturday by the State Department and the Kremlin, in which Putin and Trump “agreed that there is no military solution to the conflict in Syria.”

The two “confirmed their determination to defeat ISIS in Syria” and “agreed to maintain open military channels of communication” until that victory is achieved, the statement read.

“We can save many, many, many lives by making a deal with Russia having to do with Syria, and then ultimately getting Syria solved and getting Ukraine solved and doing other things.

“Having a good relationship with Russia is a great, great thing,” Trump insisted.

He said Putin’s involvement “would be tremendously helpful” in the effort to solve the North Korea crisis and denuclearize the Korean peninsula — a major topic during Trump’s visit with Chinese President Xi Jinping in Beijing earlier last week.

“If I had Russia and China helping us with North Korea, I think that would solve it,” Trump said.

“And this artificial Democratic hit job gets in the way,” he said, an apparent reference to the Russian collusion probe.

“It gets in the way. And that’s a shame because people will die because of it,” he added.

Later Sunday, Trump will head to the Philippines for the final leg of his tour and a meeting of the Association of Southeast Asian Nations.