A serial bank robber who was mistakenly released from the Metropolitan Correctional Center in Manhattan in August because of a bureaucratic snafu — just days before convicted pedophile Jeffrey Epstein hanged himself in his cell at the same jail — is going back to prison for a lengthy stay.

A federal judge on Friday sentenced Michael Matthews, 58, to 235 months, which was almost four years more than the harshest sentence that prosecutors were seeking for bank robberies that Matthews committed last year in Manhattan and Queens.

Matthews’ attorneys had pushed for a five-year sentence, arguing that the prolific bandit was withdrawing from heroin when he came out of prison prior to his 2018 bank robbery spree and noting that he turned himself back in to the MCC just two days after he was erroneously freed last month.

“He came back to demonstrate to everyone that he has changed,” said his attorney Mildred Whalen, who also cited his age, health and desire to kick drugs as justification for a shorter sentence.

But Brooklyn federal Judge Dora Irizarry didn’t buy the tale of redemption from Matthews. He committed the heists shortly after getting released from a prison in 2018, after doing six years for past bank robberies.

The judge pulled out the transcript from his 2012 sentencing in Manhattan federal court and pointed to the fact that he made the same kind of arguments for mercy before a different judge — and that he did nothing during that sentence to get clean and sober.

“The light bulb didn’t go off,” the judge said. “Now all of a sudden the light bulb goes off. I’m not sold on it.”

On Oct. 1, 2018, less than one week after his release, Matthews held up a Capital One Bank branch in Queens and made off with $2,071, according to court papers.

He committed three additional bank robberies over the next 11 days.

While he was being held on the latest charges, MCC staff received word that the escape charge against Matthews was getting dropped — and the staff mistakenly took that as a signal to let him walk, regardless of the fact that the government noted in court papers that he “should not be released.”

The Bureau of Prisons declined to comment, adding that the matter is “under review.”

Matthews surrendered one day before another giant flub for MCC staff — Epstein’s suicide, which occurred when guards who were supposed to be checking on him every 30 minutes left him alone for three hours.