New York Times reporter M. A. Farber withdrew his latest petition for release from jail yesterday when a federal judge began asking about Farber's $75,000 contract to write a book on the "Dr. X" murder case.

As a result, Farber, who was jailed eight days ago for contempt after he and his newspaper refused to obey a subpoena for his notes on the murder case, will remain in Bergen County Jail, N.J., for at least two more weeks.

The reporter, who failed in several legal efforts to avoid imprisonment, had petitioned U.S. District Court Judge Frederick B. Lacey for release under habeas corpus in a final effort to get out of jail pending a hearing on his case by a New Jersey appellate court.

But when Farber and Times attorney Eugene Scheiman appeared in Lacey's courtroom in Newark yesterday, the judge questioned Farber sharply about the book he is writing. When it became evident that the judge would order Farber to turn over his manuscript, Farber, to cut off the hearing, withdrew his petition.

If the judge had ordered production of the book manuscript, The Times said later, Farber would have refused. That could have placed him in jeopardy of a second contempt citation.

Lacey ripped into Farber for "profiting handsomely" from the murder trial while he was refusing to provide his notes on the case to lawyers representing the defendant, Dr. Mario Jascalevich.

Jascalievich is on trial for the murder of three patients who died at a small hospital where he worked in Oradell, N.J. Jascalevich was indicted after a series of articles by Farber in the Times indicated that a "Dr. X" murdered the patients with injections of the paralyzing drug curare.

Jascalevich's defense lawyer, Raymond A. Brown of Jersey City subpoenaed all of Farber's notes and records, and the trial judge ordered Farber and The Times to comply.

The reporter and his newspaper have refused. They say the subpoena, which necessarily requires identification of Farber's anonymous sources, violates a reporter's First Amendment right to gather news without government interference.

Judge Lacey suggested yesterday, though, that Farber may be refusing to comply with the subpoena because he has a financial interest in seeing Jascalevich convicted.

"He has it in his power, perhaps," Lacey said, "to help Jascalevich in his trial and perhaps even to obtain an acquittal for Jascalevich. Yet, ironically, if he obtains an acquittal for Jascalevich, the book goes down the drain."

At yesterday's hearing, Lacey recited in detail the terms of Farber's contract with his publisher, Double-day and Co. He said Farber had received a $75,000 advance for the book, and that, with various clauses, the reporter could make $500,000 if the book sold well.

The judge said that Doubleday had turned down Farber's first overtures about a book on the case, but then offered Farber a contract after Jascalevich was indicted.

"If Dr. Jascalevich is acquitted," Judge Lacey said, "Farber's dream of making a half-million dollars will be punctured."

James Goodale, The Times' counsel, said Lacey was wrong on the economics of the situation because "the book will be published whether the man is convicted or not."

And he said the judge's comments were "absolutely, totally irrelevant" to the legal issues involved in Farber's resistance to the subpoena.

"Writing the book is part of the First Amendment process," Goodale said. "(Farber's) position is that turning the manuscript over to the editors at the publishing house was part of that process. It makes no difference whether he reported for a newspaper or a book."

The contents of the manuscript did not come out at yesterday's hearing because Farber withdrew his petition before the questioning reached that point.

But if the manuscript contains any information sought by the defense, Farber's willingness to publish the information in a book might undercut his claim of a privilege to withhold it from the defense.

With the withdrawal of the habeas corpus petition, Farber has apparently lost his last chance for early release from jail. He will remain in jail in Hackensack, N.J., until the Jascalevich trial ends or until his appeal is heard on Sept. 18.

The trial is expected to run at least two more weeks.