Once dubbed “The Most Hated Man in America” for jacking up the price of an HIV drug, the 34-year-old was convicted of securities fraud last month for mismanaging two investment funds.

Freed on a five-million-dollar bail while awaiting sentencing, Shkreli was hauled back into court to answer for having offered a $5,000 reward to anyone who would grab a strand of Clinton’s hair.

His lawyer Benjamin Brafman — who has painted his client as a misunderstood “genius” — argued long and hard with US District Judge Kiyo Matsumoto against sending him to jail.

Shkreli himself had written to the judge apologizing for his “poor judgment” and insisting he “never intended to cause alarm or promote any act of violence whatsoever.”

“It never occurred to me that my awkward attempt at humor or satire would cause Mrs. Clinton or the Secret Service any distress,” Shkreli wrote.

But Judge Matsumoto decided otherwise, ruling that his online threats constituted “solicitation of assault” and posed a danger to the community.

“His bail was revoked and he was remanded to a detention facility,” said Tyler Daniels, spokesman for the US Attorney’s office in Brooklyn.

He will now remain in prison until his sentencing hearing, set for January 16 next year.

Shkreli is best known for ratcheting up the price of HIV drug Daraprim from $13.50 a pill to $750 overnight in 2015. Although that incident had nothing to do with his trial, so great was his notoriety that it was initially difficult to find an impartial jury.