Embattled lawyer Michael Avenatti betrayed the porn star who made him famous — by scamming nearly $300,000 in advance payments to Stormy Daniels for her memoir, the feds said Wednesday.

Avenatti, 48, was charged with wire fraud and aggravated identity theft in a case that further damaged his reputation in the wake of his March arrest in a pair of coast-to-coast extortion and fraud schemes.

He allegedly emailed a letter with Daniels’ forged signature to her literary agent on Aug. 1, directing that payments from her publisher be wired to his account instead of to her.

Avenatti subsequently received two payments of $148,750 each, which he promptly used for “his own purposes,” including making a lease payment on a Ferrari “and to pay for hotels, airfare, meals, car services and dry cleaning,” a Manhattan federal court indictment says.

The indictment doesn’t identify Daniels by name, but the details in it make it clear that she’s the person referred to as “Victim-1.”

Daniels memoir, “Full Disclosure,” was published in October and details her claim of a 2006 affair with President Trump.

Her $800,000 contract called for payment in four installments, and Avenatti is accused of stealing the second and third.

Court papers say he lied to Daniels in late August by telling her he’d help her get the second installment, even though he’d received it weeks earlier and spent all but $625, court papers say.

On Sept. 5, he used money from “another source” to pay Daniels and cover up the theft, according to Manhattan US Attorney Geoffrey Berman.

But little more than a week later, Avenatti allegedly arranged to have Daniels’ publisher make the third payment early, and promptly spent it all after it was wired to his account.

When Daniels later asked about that payment, Avenatti repeatedly claimed that he was seeking it from the publisher and “threatening litigation,” court papers say.

The indictment was one of two unsealed on Wednesday, with the other charging Avenatti with extortion in a previously alleged attempt to shake down Nike for more than $20 million.

Avenatti also faces federal prosecution in California, where he’s accused of ripping off five clients, including a paraplegic man, as well as scamming bank loans, evading taxes and lying during bankruptcy proceedings.

In a series of tweets, Avenatti denied that he “misappropriated or mishandled” Daniels’ money and claimed that he was “entitled to any monies retained per my agreement with the client.”

“She received millions of dollars worth of legal services and we spent huge sums in expenses. She directly paid only $100.00 for all that she received,” he wrote.

“I will be fully exonerated once the relevant emails, contracts, text messages, and documents are presented.”

Clark Brewster, a Tulsa-based attorney who represents Daniels, said that Avenatti cut-and-pasted Daniels’s signature from a fee agreement that Daniels signed with Avenatti and placed it on a directive to her book publisher, sent in August, to send him the payments.

The alleged scheme came to light in February when Daniels approached Brewster about representing her and he took a look at the documents.

“I knew pretty clearly that the conduct was violative of federal law on so many different levels,” Brewster said. He contacted federal prosecutors in Manhattan about the scheme and Daniel testified before a grand jury about one month ago.

Following Avenatti’s March arrest, Daniels tweeted that she was “saddened but not shocked,” adding that she had fired him “after discovering that he had dealt with me dishonestly and there will be more announcements to come.”