A Cook County judge ruled Friday that alleged gunman Dwright Boone-Doty can represent himself at his upcoming trial for the murder of 9-year-old Tyshawn Lee.

Boone-Doty on Monday had asked to serve as his own attorney, earning a swift denial from Judge Thaddeus Wilson, who quizzed the 25-year-old high school dropout about his education and understanding of the law and finer points of forensic science.

At a hearing Friday, Wilson reconsidered and cautioned Boone-Doty that there would be no delays granted in the case — even though prosecutors said they likely won’t have time to prepare thousands of pages of reports and other evidence for Boone-Doty to review before jury selection is set to begin Sept. 9.

If convicted, Boone-Doty would face a potential life sentence.

“I can’t say I’m ready right now, I ain’t seen all my discovery,” Boone-Doty told the judge in a soft voice.

“Best of luck,” said Wilson, who said a lawyer from the public defender’s office would be appointed as “standby counsel” to advise Boone-Doty during the trial.

“When you say you’re ready for trial, you’re ready for trial, as is ... you had four years to prepare yourself for trial. Four years to hire a private attorney. Four years to say you want to represent yourself.

“Now, with two weeks to go to trial, you say you want to represent yourself. There’s no continuances.”

Boone-Doty is to stand trial alongside co-defendants Corey Morgan and Kevin Edwards, who allegedly plotted to assassinate Tyshawn as a tit-for-tat battle between rival gangs that spiraled out of control in fall 2015. Tyshawn’s father was purportedly a member of a rival gang, whose members had been involved in a shooting that had wounded Morgan’s mother and left his brother dead.

The trial promised to be a logistical challenge even before Boone-Doty opted to represent himself. To avoid having jurors hear evidence that is incriminating for some of the defendants but inadmissible hearsay against others, Wilson plans to select separate juries for the three defendants, with jurors shuttled in an out of the courtroom depending on what evidence is being presented.

Assistant State’s Attorney Tom Darman said Boone-Doty’s last-second demand to represent himself was a last-ditch effort to derail the prosecution and set up an appeal since there is little time for him to go over case documents. “This is a trick bag move by the defendant,” he complained.

Prosecutors said they will provide redacted, printed copies of the various filings, reports and other evidence already handed over to Boone-Doty’s lawyers.

Wilson acknowledged the difficulty Boone-Doty had inflicted on himself and the prosecution, but also that he was obliged to move the case forward and honor the defendant’s request.

“It will be impossible for him to review it [filings],” Wilson said. “I’m going to go down the road and make that for the record.”