Gov. Cuomo on Wednesday threatened to sue US Immigration and Customs Enforcement for what he called relentless “unconstitutional” round-ups of undocumented immigrants in the state.

Joined by immigrant-rights advocates at his Manhattan office, Cuomo also said he’s issuing an executive order to block ICE agents from arresting people at state buildings without a judicial warrant.

The order, however, will not apply to courthouses, according to the state’s Office of Court Administration.

“We are going to put them on notice today that if they continue the state will sue them – period — because the state has the responsibility to uphold the constitutional rights of the people who live in New York,” said Cuomo, referring to a cease and desist letter the state sent to ICE.

Cuomo accused ICE of violating the constitutional rights of US citizens and the civil rights of undocumented immigrants.

He also said immigration officers endanger public safety by not always notifying local cops before conducting raids, saying such practice could potentially set off a standoff between multiple branches of law enforcement.

The governor made the announcements following an uninvited raid of a dairy farm in Rome, NY.

The incident infuriated many other pols, including Sen. Kirsten Gillibrand (D-NY), who has called for a federal investigation.

The farm’s owner, John Collins, was joined by Cuomo while recalling how he was shoved, handcuffed and threatened with arrest by ICE officers for questioning why they were detaining one of his workers, Marcial DeLeon Aguilar.

Collins said there was no reason to “abruptly” pin down and arrest the immigrant from Guatemala — especially in front of his children.

Messages with ICE were not immediately returned.

ICE agents have rounded up 225 people statewide the last week – including 180 who were convicted criminals or had criminal charges pending, according to officials.