The Chinatown vagrant accused of fatally bludgeoning four other homeless men over a week ago was sprung from jail not once but twice by misguided nonprofits pushing bail reform, court documents show.

Crazed bum Randy Santos, 24, had been in Manhattan Criminal Court on April 25, 2018, for a hearing on a misdemeanor assault rap for punching another guy in the face when he began to “whistle loudly,” prompting officers to toss him from the room, according to a criminal complaint obtained by The Post.

Santos went berserk, shoving a court officer and refusing to obey orders not to re-enter the courtroom, the papers say.

He was eventually arrested and booked on obstruction and resisting arrest charges. While awaiting arraignment, he was cuffed to a bench, where he wildly kicked at passing court officers, sources said.

A judge ordered him held on $500 bail. The next day, a student from NYU Law School’s Washington Square Legal Services Fund bailed him out, putting him back on the street, court records show.

The student-run nonprofit’s mission, according to its website, is to end cash bail — and until then “subvert the cash bail system by bailing out as many people as possible.”

Court officers union chief Dennis Quirk told The Post on Monday, “They should be ashamed of themselves.

“Anyone who attacks anyone in law enforcement should be given severe jail time, not bailed out. It sends a bad message.”

Five days after the bail-out, Santos failed to show up for a hearing in his original assault case, and a bench warrant for his arrest was ordered. He was eventually picked up. On Nov. 28, 2018, a Manhattan judge was forced to drop the assault and obstruction cases after prosecutors failed to answer ready for trial.

If a case doesn’t go to trial within a legally specified number of days, it is automatically dismissed in accordance with New York law.

Over the next months, Santos then went in and out of custody again, picking up new cases in three boroughs and failing to show up to court on them, including for allegedly groping a woman March 8 in Queens.

His $1,000 bail in that case was posted by another nonprofit, Bronx Freedom Fund, in August, leaving him free on Oct. 5 to fatally beat four sleeping homeless men with a metal pole and leaving a fifth critically injured, officials say.

He was indicted last week in connection to the murderous rampage and is due back in court Oct. 28.