A federal judge has told the Obama administration to decide by next week whether it intends to force a reporter for The New York Times to testify at the trial of a whistle-blower, bringing to a head the most serious confrontation between the government and the news media in many years.

The reporter, James Risen, has been fighting government subpoenas in the case since 2008, but the Justice Department has refused to abandon its effort to force him to discuss his confidential sources. In June, the Supreme Court declined to review the matter, letting stand a federal appeals court ruling that allowed the government to compel his testimony.

Federal prosecutors have not made a move since, apparently unsure whether they want to press ahead — and be prepared to imprison Mr. Risen if he will not take the stand — or reverse course and drop the subpoena. On Tuesday, Judge Leonie M. Brinkema of Federal District Court in Alexandria, Va., decided that the delay had gone on long enough. In a one-page order, she noted, with seeming impatience, that the government had had “over six months” to make up its mind, and set a deadline of next Tuesday for it to commit to a position on Mr. Risen.

The trial of the whistle-blower, Jeffrey Sterling, a former Central Intelligence Agency official, is scheduled to begin less than a month later, on Jan. 12. Prosecutors say that Mr. Sterling provided Mr. Risen with information about a botched C.I.A. attempt to sabotage Iran’s nuclear weapons program, which Mr. Risen wrote about in his 2006 book, “State of War.”