Harvey Weinstein arrived in a Manhattan courtroom on Thursday morning hoping a state judge would throw out the remaining criminal charges against him. Several Hollywood actresses sat in the gallery, hoping for the opposite outcome.

The last time Mr. Weinstein had appeared in court the same judge, James Burke, had dismissed part of the indictment against him after it was revealed that a police detective on the case had withheld crucial evidence from prosecutors.

Since then, Mr. Weinstein’s lawyer, Benjamin Brafman, had filed a new motion asking Justice Burke to throw out the remaining sexual assault charges because prosecutors did not share “highly exculpatory evidence” with the grand jury, including correspondence suggesting the women had remained on friendly terms with Mr. Weinstein after the alleged attacks. He argued “police and prosecutorial misconduct” had tainted the grand-jury’s decision-making.

But Justice Burke swept into State Supreme Court at 9:30 a.m. and immediately announced that he would not throw out the remaining counts against the once powerful producer. His decision paved the way for Mr. Weinstein to face trial next year on charges that he raped one woman and forced another to allow him to perform oral sex on her. Justice Burke later released a written opinion.