New York billionaire Carl Icahn, a longtime ally of President Trump who briefly served in the administration, sold $31 million in stock in a company that depends on steel just weeks before the president announced steep tariffs on imported steel, a new report said Friday.

In a filing submitted to the Securities and Exchange Commission on Feb. 22, Icahn revealed that he had dumped nearly a million shares of Manitowoc Company Inc., according to ThinkProgress, a left-leaning public policy website.

The company was described as a top global manufacturer of cranes and other heavy equipment that relied heavily on steel for its products.

Days later, Trump announced a 25 percent tariff on steel imports and a 10 percent tariff on imported aluminum — a move which some of his top economic advisers and GOP lawmakers opposed, and which set Wall Street reeling.

Manitowoc stock tanked, losing about 6 percent of its value, and Reuters blamed the drop on the fact that Manitowoc was a “major consumer of steel.”

Icahn had not actively traded Manitowoc stock until February, the website reported, making no purchases or sales between January 2015 and Feb. 11.

The report does not allege wrongdoing, but notes that “Carl Icahn has impeccable timing.”

The billionaire investor served the White House briefly as a “special adviser” to the president.

But he stepped down in August as the New Yorker magazine was set to publish an article about how he was allegedly using his White house connections to protect his investments.

Neither the White House nor Icahn immediately responded to a request for comment from The Post.