In a surprise move, The New York Times yesterday gave up all its papers on the controversial "Dr. X" case to a judge here after the paper said it discovered the documents had already been made available through other sources.

Floyd Abrams, attorney for the Times in the civil and criminal contempt actions here stemming from the newspaper's refusal to make its Dr. X papers available, said The Times elected to avoid a First Amendment challenge because its only documents on the case were "internal documents relating to contractual arrangements." Abrams said no reporters' notes were turned over to acting Superior Court Judge William J. Arnold.

The Times decision does not affect the separate case of its reporter Myron Farber, Abrams said. Farber is currently serving an indeterminate sentence in the Bergen County jail for refusing to give up his own notes on the case.

Farber wrote a series of articles in 1975 that led to the indictment of New Jersey surgeon Mario Jascalevich on five murder counts. Attorneys for Jascalevich - referred to as "Dr. X" in Farber's early articles - demanded all the reporter's notes and files on the case. Farber was jailed after he refused to turn over his notes to Arnold, who said he wanted to screen them to see if they were relevant to the Jascalevich defense.

"Abrams said Times attorneys searched the newspaper files yesterday after the Times received its second subpoena in the case this week. A June 30 subpoena demanded all the Times notes on the case and this week's subpoena required the paper to give up its files on Farber's contract to write a book and supply material for a movie about the case.

Abrams said The Times was not backing away from its position that a blanket subpoena for its files on the case violated the First Amendment.

"In the ordinary course of events we would have moved to quash this latest subpoena as an outrageous incursion into the editorial process of The New York Times," said Abrams.

"We would never have given this material over if they didn't already have it," Abrams said.

He told a crowded courtroom that a set of material virtually identical to the Times files had already been turned over to Arnold and Jascalevich's attorney Raymond A. Brown in the last several weeks by Farber's agent. Lucy Kroll, and the Warner Communications Co., which plans to make a movie about the "Dr. X" deaths.

Documents covered by the two subpoenas "are now before this court and before Mr. Brown," said Abrams. "Mr. Brown has in substance every document on the case in the New York Times file."

Earlier in the hearing here yesterday, attorneys for The Times turned over an inch-thick folder which they said contained the partially completed manuscript of the book Farber is writting on the case. Farber received a $75,000 advance for the book from Doubleday & Co.

In a letter this week to Arnold, Farber said he was making the book available to the court because of allegations by U.S. District Court Judge Frederick Lacey last week that the book advance indicated the reporter was profiteering in the case. In his letter, Farber said Lacey's accusations had distorted and obscured the First Amendment issues in the case.

Arnold accepted the manuscript yesterday but said it did not alter his determination to obtain and screen all of Farber's notes before deciding whether to hand them over to the Jascalevich defense.

Farber was fined $1,000 for criminal contempt and has been in jail since Aug. 4 because he refused to comply with the order to hand over his notes. The Times was fined $100,000 in a criminal contempt charge and an additional $5,000 a day in a civil contempt charge for its failure to produce its notes.

The newspaper's decision to give up its file on the case yesterday was unexpected.

Arnold, however, said the papers would be formally turned over to Superior Court Judge Theodore Trautwein early next week. Trautwein was the judge who issued the initial subpoena June 30 for the notes from the newspaper and its reporter.

Abrams said the newspaper would appeal both the civil and criminal contempt citations against it. By turning over its documents, Arnold told the newspaper's attorneys, "You may be able to purge yourselves for contempt and save yourselves some money, too."