The odds of R. Kelly ever walking free again have grown even slimmer.

Five days after being broadsided with a damning pair of indictments, the superstar singer stepped into a federal courtroom wearing an orange jumpsuit Tuesday only to hear a prosecutor say the alleged victim from his 2008 child pornography trial — whose refusal to testify was famously blamed for his acquittal — is cooperating with federal investigators.

“She has now gone on record,” Assistant U.S. Attorney Angel Krull said of that woman during an arraignment and detention hearing for Kelly, who looked stunned throughout the proceeding.

Then, U.S. District Judge Harry Leinenweber ordered Kelly locked up while awaiting trial.

The woman from the 2008 trial represents just one piece of the serious federal prosecution facing Kelly, Krull made clear. Kelly faces a combined 18 counts in indictments in Brooklyn and Chicago for alleged crimes against 10 victims. He could go to prison for as many as 195 years for the Chicago case alone. Out east, he faces decades more.

Meanwhile, the prosecutor said Kelly is an “extreme danger” to the community and a serious flight risk. She said authorities have gathered “overwhelming evidence” against him, and “his victims are cooperating with law enforcement.”

“Our investigation,” she added, “is far from over.”

Kelly, 52, pleaded not guilty through his lawyer to the Chicago charges Tuesday. But he didn’t appear to react to any of the prosecutor’s allegations. The singer kept his hands behind his back when he entered the packed 19th floor courtroom at the Dirksen Federal Courthouse. He took a seat as lawyers prepared to make their arguments. And then he looked straight forward — at no one in particular, it seemed.

Kelly uttered only the words “yes sir” when Leinenweber asked him a question during the hearing. The superstar’s lawyer, Steve Greenberg, said Kelly has been held in solitary confinement because of his notoriety.

When the hearing ended, Kelly appeared to whisper something to Greenberg. Then he turned, put his hands behind his back and returned to the lockup with his head bowed. Greenberg later told reporters that Kelly was disappointed.

“He’s in 24-hour-a-day solitary confinement,” Greenberg said. “Essentially, it’s the hole because that’s the safest place for them to house him. That’s not his fault. No TV, no anything. No contact with other people. It’s largely inhumane.”

Tuesday’s hearing lasted roughly an hour, but it left unanswered questions about how the case will proceed. For example, it was unclear whether the feds would take Kelly to New York to be arraigned on the indictment there, or if that arraignment could be handled in Chicago by video conference.

Meanwhile, Leinenweber set a Sept. 4 status hearing for Kelly here.

Kelly has been locked up in the Metropolitan Correctional Center in downtown Chicago ever since the feds hit him with the two indictments last week. Agents arrested him on Wabash Avenue while he was walking his dog outside Trump Tower, where he lives.

In Chicago, Kelly faces 13 counts revolving around child pornography, enticing a minor into illegal sexual activity, and a conspiracy to obstruct justice — alleging Kelly thwarted his prosecution a decade ago with threats, gifts and six-figure payoffs.

Also named as defendants in the case are Kelly’s longtime manager, Derrel McDavid, and Kelly employee Milton “June” Brown.

Kelly faced trial for child pornography in state court here in 2008. A jury acquitted the artist, complaining to reporters that Kelly’s alleged victim never took the stand.

But the new Chicago indictment describes alleged behind-the-scenes maneuvering designed to protect Kelly as he faced that prosecution. It says Kelly, McDavid and others intimidated the alleged victim and her parents into lying to police and a grand jury. They also allegedly paid hundreds of thousands of dollars as they tried to track down tapes of Kelly having sex with minors before prosecutors found them.

Nevertheless, federal prosecutors in Chicago now claim they have three Kelly sex tapes in their possession and can present evidence of a fourth.

In Brooklyn, Kelly also faces a broader racketeering case that alleges his music career was designed to enable and protect him as he sexually exploited young women by isolating them, controlling them and making them call him “Daddy.”

Kelly allegedly would not let his victims leave their room without his permission — not even to eat or go to the bathroom — forced them to wear baggy clothing and forbade them from looking at other men.

The effort to prosecute Kelly has been gaining steam ever since the release earlier this year of the Lifetime documentary series “Surviving R. Kelly.” But it dates back to 2002, when Jim DeRogatis — then a music critic and reporter for the Chicago Sun-Times — received a sex tape he passed on to police.

During Tuesday’s hearing, Greenberg told the judge Kelly is broke, doesn’t own the royalties to his songs and faced serious jeopardy when he went to trial in 2008, despite the obstruction of justice claims. Nevertheless, he said Kelly has always shown up to court.

Hoping to free Kelly from the federal jail, Greenberg also told the judge his client has no TV in solitary confinement and can’t even read a book — because he can’t read or write.

“He literally sits there, in isolation, all day long,” Greenberg said.

But Krull said the federal case against Kelly is a game-changer. Even though Kelly has also faced new state court charges since February, she said they were filed within the same system where Kelly “illegally obtained an acquittal” in 2008 as the leader of a conspiracy to obstruct justice.

The prosecutor said Kelly inflicted physical and psychological harm as he sexually abused his victims. She said they were young — some were even in middle school.

And then, to drive her point home, Krull said those words again:

“Middle school.”