“History repeats itself, first as tragedy, then as farce,” Karl Marx said. We can be forgiven for assuming he had the outrageous behavior of the Deep State in mind.

It was tragic when it became apparent that the FBI, CIA and other government agencies abused their powers to interfere in the 2016 presidential election and try to help Hillary Clinton win. Now it is farce that some of the same agencies are up to their old tricks again in the 2020 election.

The evidence of foul play comes via two of the strangest newspaper stories ever published. The first was in the New York Times, which reported breathlessly Friday that “intelligence officials warned House lawmakers last week that Russia was interfering in the 2020 campaign to get President Trump re-elected.”

The first reaction was a universal “Here we go again.” If you suffer from Trump Derangement Syndrome, you assumed he was once again colluding with Vladimir ­Putin to steal the election.

If you support Trump or are simply sane and fair-minded, you realized Democrats and insiders were once again trying to frame him as a traitor and delegitimize his presidency.

Then came the farce. Soon the Washington Post had its own scoop, a report that “Russia is trying to help Bernie Sanders’ campaign.”

Whoa, Nellie! Inquiring minds are confused. Whose side are the Russians on?

How can it be that Putin is trying to help both the Republican nominee and the likely Democratic nominee at the same time? Is he stupid? The better question is this: Do Deep Staters and their media handmaidens think Americans are stupid?

Yes, they do. They count on it.

It is troubling that Trump and Sanders were given conflicting information, suggesting that the intel officials don’t have their facts right. More telling about the aim is the fact that both briefings were leaked, demonstrating that nothing has changed and that insiders are still using classified information for political purposes.

Calling the situation swampy doesn’t do it justice. The continuing corruption of the nation’s intelligence and law enforcement agencies is a true threat to those institutions because it destroys public trust in them.

That was supposed to have been fixed by now. Recall that the snakes who carried out the 2016 attack on democracy are gone from their agencies. Jim Comey, Andrew McCabe, Peter Strzok and Lisa Page are no longer calling the shots and manipulating the FBI’s agenda.

Similarly, John Brennan and the cabal of crooked spooks are gone from the CIA and other abusers have been swept out of the Justice Department.

Yet still the same problem sur­faces. Intelligence gathered to keep the nation safe and protect the integrity of elections is leaked for the purpose of partisanship.

That can only mean new snakes have taken the place of the old ones. Different people, same dirty tricks.

Sanders and Trump had similar reactions in the sense that both saw the leaks as evidence of plots to hurt them politically. Trump also reacted to the briefing by bringing in a new director of national intelligence, naming Richard Grenell, our ambassador to Germany, to clean house.

Naturally, left-leaning heads exploded everywhere amid charges that Grenell is a loyalist who has no intelligence background.

The smart response is twofold: First, the current director, Joseph Maguire, held the job in an acting capacity and by law had to leave by March 12. Similarly, Grenell will hold the job only temporarily while a permanent replacement is found.

Second, a look at the recent record suggests that having experienced intelligence officials in the post might be why the agencies have gone off the rails. Their loyalty to democracy is suspect, so maybe an outsider can get the system back on track.

The change comes as Trump also plans to shrink the size of the National Security Council, which has ballooned in recent decades. Some of its members, most notably Lt. Col. Alexander Vindman, were witnesses against Trump in the impeachment coup. Vindman has been moved from the White House and sent back to the military.

Clearly, more needs to be done and that puts extra weight on Attorney General Bill Barr’s criminal probe of the 2016 investigators. So far, none of those involved has been charged with crimes and prosecuted.

Unless that changes, corruption will spread and become routine rather than a disturbing exception. Indeed, with Comey, McCabe, Brennan and others saluted by anti-Trump media outlets and rewarded with fat book and television contracts, being a snake is far more lucrative than doing an honest job. That’s the real death to America.

Bum bares city’s dysfunction

The Post stories about the vagrant who allegedly threatened to shoot up a homeless shelter office in Penn Station neatly sum up much of what is wrong with modern New York.

The vagrant, Eugene Watts, has been arrested more than 100 times, including five on felony charges. The threat caused the Bowery Residents Committee to shut its offices for days — despite having a contract with Amtrak to deal with the homeless people flooding the station.

Meanwhile, The Post saw Amtrak cops warn Watts, then walk away as he sat on the floor, drinking a beer.

Finally, the embarrassing reports worked their magic. Watts was busted Friday and held on $5,000 bail in Manhattan Criminal Court. And the homeless offices reopened.

What a relief. Now Penn Station can get back to its regularly scheduled chaos, mayhem and squalor.

Trump could spit these Dems out

The fiery clash between Sen. Bernie Sanders and Michael Bloomberg during the Las Vegas debate turns out to have been just a warmup. In the days since, both have made the charge that the other would be destroyed by Trump.

The president will “chew him up and spit him out” in the general election if Bloomberg wins the nomination, Sanders said in a TV interview.

For his part, Bloomberg told a Utah crowd that “if we choose a candidate who appeals to a small base, like Sen. Sanders, it will be a fatal error.”

Here’s the rub — both could be right. It’s likely that neither man could unite the party and bridge its sharp ideological divide, paving the way for four more Trump years.

That’s the dilemma Democrats face and there is no obvious way to fix it. Because none of the other candidates looks able to mount a credible run for the nomination, the campaign is shaping up as a two-man race.

It’s a very odd race, too. Neither Bloomberg nor Sanders was a registered Democrat until recently. Both are Jewish and white 78-year-old New Yorkers. One is a gruff billionaire mogul with a reported eight houses, the other a gruff socialist millionaire with three houses.

Heckuva job, Dems.

Alas, ‘Secret’ is out

From the AP: “Struggling Victoria’s Secret sold as women demand comfort.”

Sweetheart, get me rewrite!