The man accused of brutally bludgeoning five homeless men as they slept on the streets of Chinatown over the weekend allegedly attacked another homeless man a week before his murderous rampage, authorities said Tuesday.

Randy Santos — who was set free on city streets after two big breaks from the criminal justice system — has copped to beating the four homeless men to death and severely injuring another. He faces multiple murder charges in connection with the early Saturday attacks.

Now police say the 24-year-old vagrant with a history of violence has been linked to another attack, but the homeless victim was able to fend him off.

The victim told cops he was sleeping overnight on the West Side north of the Chelsea Pier on Sept. 27 when he awoke to find a man attacking him with a stick, said NYPD Chief of Detectives Dermot Shea at an unrelated press conference Tuesday.

The attacker tried to force the victim over the banister at the pier, but the homeless man, who suffered cuts to his chest, was able to fight him off, said Shea.

The NYPD said it has video surveillance footage that captures Santos only seven blocks away from the previously unreported incident and they “believe he was responsible for that attack,” according to Shea.

Top brass urged anyone else with information about other encounters to come forward.

Mayor Bill de Blasio, who has pledged more resources for homeless New Yorkers, said Tuesday the violent episode “could not have possibly been predicted.”