The NYPD hate-crimes unit is investigating threats made to a Brooklyn Civil Court judge who was sworn in on a Koran, The Post has learned.

Judge Carolyn Walker-Diallo got two calls at 11:30 a.m. Tuesday at the courthouse on Schermerhorn Street, law enforcement sources said on Wednesday.

“You are not an American because you got sworn in on a Koran,” a male caller said.

“You’re a terrorist; we are going to get you,” a woman said in the second call.

David Bookstaver, a spokesman for the state’s courts, said judges need only swear an oath of office that they will uphold the law, and that there are no requirements to use a religious text.

“You can be sworn in on a comic book. You don’t need to sign in on anything; you just need to sign your oath,” he said.

Many judges use no religious text, while others use the Bible or the Talmud if they are religious, he added.

He could not recall if any other judge has used a Koran.

The phone threats followed a backlash on Facebook and Twitter after the judge posted a video of her swearing-in ceremony last Thursday on Facebook.

And they come at a time when anti-Muslim feelings are running high following the jihadi attacks in Paris and California.

“New York deserves everything it gets. #Wakeup­America Carolyn Walker-Diallo, Muslim judge, sworn in on Koran,” Ray Ortega wrote on Twitter.

“Warning a true patriot will take action,” threatened a user named Chris, a self-described disabled veteran and supporter of Donald Trump, who has called for a halt to Muslim immigration.

Experts said there was no reason for her not to be sworn in on the Koran since she is a Muslim.

“Not only can she, but she should,” Eugene Volokh, a religious scholar, wrote in the Washington Post.