A newspaper reporter was held in contempt of court here today after refusing a federal judge's order to confirm that she talked to a U.S. attorney while preparing stories in February about the FBI's undercover Abscam investigation.

U.S. District Court Judge John P. Fullam said Philadelphia Inquirer reporter Jan Schaffer could be jailed for six months if she continued to refuse to answer defense attorneys' questions about a conversation she had with Peter Vaira, the U.S. attorney in Philadelphia, last Feb. 2. She was allowed to remain free while her attorney filed an immediate appeal.

The contempt citation was the latest in a sequence of extraordinary events at the week-long pretrial hearings in the Abscam case involving three members of the Philadelphia City Council and a lawyer who allegedly was the key middleman in the operation. Earlier in the week, Vaira testified that he had called Schaffer to alert her to the Abscam story as it was breaking in February. Other government attorneys and investigators also testified about leaks to the press, and veteran prosecutors and defense attorneys said they could recall no precedent for such a string of Justice Department officials being called on to testify publicly about their relationship with reporters.

Defense attorneys are trying to find evidence of leaks to support their motions to dismiss the charges because of prejudicial pre-indictment publicity. The Abscam story broke Feb. 2 and 3 when several news papers and NBC-TV disclosed details of the undercover operation.

The three Philadelphia officials indicted are George X. Schwartz, the council president, and members Harry P. Jannotti and Louis C. Johnson. They were charged with violating racketeering and extortion laws by taking $65,000 last January from FBI agents posing as representatives of a wealthy Arab sheik.

Five members of Congress also have been indicted so far in the Abscam investigation, in which agents videotaped the transaction. A federal judge in Brooklyn has scheduled a pretrial hearing there Friday in the cases against four of the members of Congress.

The defense attorneys' efforts this week have been aided by an unprecedented Justice Department investigation into the source of the leaks, which has included the use of lie detector tests on attorneys and FBI agents. Unlike most previous cases involving claims of excessive pretrial publicity in criminal cases, government officials as high as Attorney General Benjamin R. Civiletti have acknowledged that the Abscam leaks came from Justice employes.

Schaffer's troubles began Tuesday when Vaira testified that he had alerted her Feb. 2 that the Abscam story was about to break in other publications. Later that same night, he added, he confirmed for her the names of the Philadelphia targets of the investigation. He also said he had taken a lie detector test in the internal Justice leak investigation.

Fullam had denied earlier defense attempts to call reporters to the witness stand. But he agreed to Schaffer's questioning after Vaira, in effect, had waived any claim of confidentiality.

Richard Sprague, Schwartz's attorney, asked Schaffer if she had talked to Vaira that evening in February as he testified. After consulting with her attorney, Harold Kohn, Schaffer said that she would "respectfully decline to answer the question." The judge then ordered her to answer either yes or no. When she continued to refuse, he said, "All right, you're held in contempt."

In an order filed later in the day, the judge said he had made clear in previous rulings his view "that no reporter could properly be compelled, against his will, to reveal a confidential source."

He added however that when a witness testifies about what he told a reporter, the reporter may be required to testify at least to corroborate or contradict the witness.

He said it was his view that the information sought from Schaffer was relevant to the hearing, that it would provide either corroboration or impeachment of Vaira's testimony, "which was not available from any other source, and that a truthful response to the question would not have violated any privilege."

Eugene Roberts, executive of the Inquirer, said in a telephone interview that the newspaper decided to make a strong claim of privilege from the beginning because it seemed apparent that the defense attorneys were trying to pinpoint the source of government leaks by a process of elimination.

Roberts said the judge's comments were probably true as an "isolated incident," but he feared that answering any questions at all would open up the reporter to future questioning that could lead to disclosure of confidential sources by a process of elimination.

Robert W. Greene, an editor at th e Long Island paper Newsday, which also broke the story Feb. 2, voiced similar concerns on the witness stand today. Greene was called to answer questions about the previous day's testimony by Melvin Weinberg, a convicted confidence man who was the FBI's principal undercover figure in the Abscam investigation.

Greene said he didn't want to "open the door" that might lead to disclosure of confidential sources by even answering questions about remarks his paper had attributed to Weinberg.

But the judge said there was a "vast difference" between protecting confidential sources and confirming the accuracy of an attributed quote, and directed Greene to answer the question. Greene then did so and answered several other questions about conversations he had with Weinberg, most of them about a book he plans to do on Weinberg's life.

Stuart Ditzen, a reporter for the Philadelphia Bulletin, also was subpoenaed to answer questions after an assistant U.S. attorney acknowledged talking to him about Abscam. Ditzen is tentatively scheduled to appear in court next week.