A rookie judge appointed by Mayor Bill de Blasio refused to hold a mentally unstable career criminal on even $5,000 bail in a violent case last month — leaving him free to allegedly kill a city EMT.

Bronx Criminal Court Judge David Kirschner, who has only been on the bench since June, balked at a prosecutor’s request to set bail for suspected gang-banger José Gonzalez on Feb. 26.

Gonzalez had been hauled into Kirschner’s courtroom for getting violent with a cop during a robbery arrest — a crime he committed while free in another assault case, authorities say.

Kirschner, who served two stints as a Bronx prosecutor that totaled around 12 years, instead cut the reputed Bloods gang member loose without any bail.

On Thursday, just three weeks after he was let go, Gonzalez fatally mowed down EMT and mother of five Yadira Arroyo, 44, after stealing her ambulance, according to authorities.

“Many of [his prior busts] don’t seem that severe, but after a while, a judge has to look at the numbers — 31 arrests is a lot,” said an NYPD source, who was shocked that Kirschner appeared to have ignored all the red flags in Gonzalez’s past.

In addition to the 31 arrests, those warning signs included six stays in a psychiatric ward.

“And the one with the cop — they definitely should have at least held him on some bail,” the source said.

Another NYPD source said, “You would think with 31 arrests, the judge would have taken this a little more seriously . . . Maybe if he would have set bail and kept him in jail for a little while, maybe [Gonzalez] would have thought a little harder about what direction he was going in.”

In the case in front of Kirschner, Gonzalez, 25, originally was accused of robbery, but the victim wouldn’t cooperate. He got slapped with charges for resisting arrest and kicking out the window of a police van, after which he went on a foul-mouthed rant.

Gonzalez also had charges pending against him from a June 2016 attack on a worker at the homeless shelter where he lived, just down the block from Arroyo’s home.

Gonzalez was freed without bail in that case by another Bronx judge, Laurence Busching, who overruled a prosecution request for $2,000 bail.

Arroyo’s grieving relatives were outraged that Gonzalez was walking the streets despite his repeated arrests.

“We don’t understand why he kept getting released,” said her uncle, Edwin Rosado, 53. “He should never have been let out of jail. Especially if they’re saying he’s freaking nuts.”

Theodore Miraldi, a court-appointed guardian tapped to represent Gonzalez in Housing Court in January, after the suspect’s alleged attack on the shelter worker, told The Post he knew “there was something desperately wrong.”

Miraldi said he immediately begged off the case, in which Gonzalez was facing eviction from his homeless shelter for attacking people there, after Gonzalez ranted to him “about the Illuminati” and how he “thinks on a higher level.”

“He looks like a time bomb, and he’s ready to explode,” Miraldi said. “If I was a judge and looking at his arrest record and the type of charges, why would I let him out?”

A request for comment from Kirschner was returned by a spokesman for the state court system who said, “As we know, in New York state, bail considerations are relative to the particular case, and the judge, using his discretion, did what he felt what was appropriate for that case.”

City Hall declined to comment.

Additional reporting by Reuven Fenton

How you can help her kids

You can help Yadira Arroyo’s five children, whose education will be supported by the Silver Shield Foundation.

The 44-year-old EMT had spent 14 years with the FDNY before she was killed Thursday. Her sons are ages 7 to 23.

The Silver Shield Foundation was launched in 1982 by late New York Yankees owner George Steinbrenner for the families of NYPD officers and FDNY members who lose their lives in the line of duty.

You can make a contribution at www.silvershieldfoundation.org/donate or mail it to Silver Shield Foundation, 870 UN Plaza, 1st Floor, New York, NY 10017.