Embattled attorney Michael Avenatti is asking a judge to toss the extortion charges related to his alleged $20 million shakedown of Nike — claiming he’s the victim of a political witch hunt motivated by his beef with President Trump.

“The USAO-SDNY substituted its own personal impressions of Mr. Avenatti, drawn from his aggressive public persona, long feud with President Trump, and brief entanglement with the USAO-SDNY in the Michael Cohen investigation,” Avenatti’s lawyers writes in his filing, referencing the US Attorney’s office for the Southern District of New York.

In a 50-page submission — that identifies lawyer Mark Geragos as the long-suspected CC-1 — Avenatti slams US Attorney Geoffrey Berman as a Trump flunky and claims he was arrested and charged in federal court as retribution for representing adult film star Stormy Daniels.

“While the FBI was conducting its criminal investigation into the illegal payment to Daniels, Mr. Avenatti was President Trump’s chief antagonist in the civil arena and in the court of public opinion,” the motion says.

“If Mr. Avenatti were attorney Doe – or Mr. Geragos, for that matter – he would not have been arrested or charged, the document reads. “That USA Berman did not see fit to likewise recuse himself from Mr. Avenatti’s case but, instead, has taken a very active role in it, is circumstantial evidence that he may be considered a ‘stalking horse” for President Trump.”

In a portion of the filing, the lawyer also lays out his alleged extortion plot, which he says was just part of ironing out a settlement for his client — and that prosecutors never even bothered looking at his claims against the sports giant.

Berman’s office declined to comment on the motion in its entirety.

In addition to the Nike squeeze, Avenatti has also been accused of stealing money from Daniels, whose real name is Stephanie Clifford, and other clients in California and New York.

Avenatti represented Daniels in lawsuits against President Trump and Michael Cohen, yet she fired him and later alleged he’d defrauded her out of $300,000.

Geragos did not immediately respond to a request for comment.