The Manhattan district attorney is seeking to force a reporter for The New York Times to testify about a jailhouse interview with the man accused of killing the toddler known as Baby Hope, whose body was found in 1991 in an Igloo cooler next to the Henry Hudson Parkway.

Prosecutors have subpoenaed the reporter, Frances Robles, to testify at a pretrial hearing, and Ms. Robles is fighting the order, arguing that it violates New York State’s shield law protecting journalists. On Tuesday, however, Justice Bonnie G. Wittner rejected that argument at a hearing in State Supreme Court in Manhattan, saying she was ready to order Ms. Robles to take the witness stand.

Justice Wittner said she believed Ms. Robles’s testimony could be compelled under the shield law, because in her view it meets the legal test of being “critical or necessary” to the case and impossible to obtain elsewhere. She noted that the main evidence against the accused man, Conrado Juárez, was his own confession to the police, which his lawyer contends was coerced and false.

“The only other evidence in this case is the defendant’s statements to civilians,” Justice Wittner said. “I believe the testimony that Ms. Robles could give in this court on the statements made by the defendant days after his arraignment is critical and necessary.”