Carl Icahn — who has accused Dell’s board of giving chairman and CEO Michael Dell a sweetheart deal — recently got a pretty sweet deal himself from a company that he controls.

Last month, auto-parts maker Federal-Mogul completed a stock rights offering that allowed Icahn — its chairman and biggest shareholder — to boost his stake in the company and obtain big tax benefits at a time when the shares were trading at depressed prices.

In May, Federal-Mogul launched a $500 million stock rights offering to refinance debt. Stockholders could purchase an additional share for each one they currently held at a price of $9.78.

Federal-Mogul said the price was based on the four trading days preceding the announcement, but some analysts believe the offer undervalued a company that was already showing signs of a turnaround.

Gabelli & Co. analyst Brian Sponheimer told The Post, “Certainly, I felt the shares were undervalued at that level.”

Federal-Mogul, which traded at $10.15 the day of the May 28 announcement, has risen more than 70 percent in just four weeks. The stock closed yesterday at $17.05.

Icahn bought 44 million of the 51 million shares purchased, or 86 percent, as part of the rights offering.

The deal increased his stake in the company from 78 percent to 81 percent. Passing the 80-percent threshold also allowed him to claim $777 million in net operating losses, which he can use to offset gains in other businesses.

Federal-Mogul completed the rights offering on July 11. Less than two weeks later, it reported blowout second-quarter earnings. It posted a profit of $56 million in the quarter, compared to a loss of $59 million in the same period a year ago.

A source following the situation said Icahn and the board likely knew in late May that the company had turned a corner. “Icahn should have been forced to pay more for the stock,” the source insisted.

However, there’s little indication that Federal-Mogul’s board pushed to get the best offer price.

Similarly, Icahn has blasted Dell’s special committee tasked with evaluating a takeover offer from founder Michael Dell for being too compliant.

Like Dell, Federal-Mogul formed a special committee to determine the deal’s fairness as five of the 10 directors are also executives of Icahn Enterprises LP.

“Federal-Mogul is vastly different from Dell,” Icahn told The Post.

“Michael Dell said his company was going through rocky times and he would take the company for himself. He is freezing everyone out and taking the potential upside,” he continued.

“Federal-Mogul was going through rocky times, but instead of taking it for ourselves, we said to shareholders let’s ride this through together, and it happened that way through the rights offering.”