A federal judge on Thursday blocked New York from immediately turning over President Trump’s state tax returns to Congress.

The order by Judge Carl Nichols, a Trump appointee, bars the state from releasing the president’s tax returns while his lawsuit seeking to keep his records private proceeds.

The arm-wrestle over Trump’s New York returns began in earnest on July 8, when Gov. Andrew Cuomo signed the “TRUST Act” into law.

The Tax Returns Released Under Specific Terms Act allows the state Department of Taxation and Finance to release any elected official’s tax returns “for a specified and legitimate legislative purpose” upon the written request of the House Ways and Means Committee, the Senate Finance Committee, or the Joint Committee on Taxation.

Trump’s lawyers have argued that no records should be released prior to a judge determining the legality of the law.

The judge also set a schedule for the case to proceed — throughout which Trump’s state tax returns cannot be disclosed.

The defendants in Trump’s lawsuit — New York’s Taxation and Finance commissioner, state Attorney General Letitia James and the House Ways and Means Committee — have until Aug. 9 to move to dismiss the lawsuit.

Trump’s side has until Aug. 19 to file its reply.

The defendants have until Aug. 23 to reply to the reply.

A hearing with arguments will then be held Aug. 29.

James spun the order as a win.

“We are pleased that the court has accepted our reasonable proposal for how to move forward in this premature lawsuit filed by President Trump,” she said in a press statement.

“We look forward to continuing to make our case in court. This law is constitutional, and we will vigorously defend it.”

Bill sponsor Assemblyman David Buchwald (D-Westchester) said he believed the president’s lawsuit would eventually be dismissed on jurisdictional grounds.

“I am confident the court will rule that it does not have jurisdiction over the New York State officials and the restrictions on the state of New York will be lifted,” he said.