In an unprecedented order a federal judge in Manhattan yesterday ruled that Attorney General Griffin B. Bell automatically will be in contempt of court if he doesn't turn over confidential FBI informant files by next Friday.

U.S. District Court Judge Thomas P. Griesa denied, for now, a motion by attorneys for the Socialist Workers Party that Bell be jailed. But Griesa left that possibility open if Bell continues to refuse to comply.

This is the first time the nation's top law enforcement officer has faced a contempt citation for defying a court order. Bell did not comment immediately but a spokesman indicated that attorney general would continue to fight, most likely with an attempt to appeal the unique order.

Terrence B. Adamson, Bell's spokesman, said it wasn't likely that the attorney general would turn over the informant files by Friday. "We've had that option before," he said. "I know nothing that changes the attorney general's previous statements about the merits of his position."

Department attorneys in New York filed a notice in Griesa's court late yesterday preserving Bell's right to appeal, Adamson said. A possibility would be asking the 2nd U.S. Circuit Court of Apppeals to "stay" or delay the contempt court to consider whether to review it.

Griesa contended in his opinion that a contempt order in a civil case is not appealable at all until the final judgment. The case is 5 years old and is still in the preliminary "discovery" stage because of the lengthy fight over access to the informant files.

The SWP and an affiliate, the Young Socialists Alliance, are the informant files to get evidence for a $40 million civil suit, which charges the FBI illegally disrupted the radical political party by using informants to burglarize and harass its members.

Griesa ordered that 18 of the files be turned over to SWP attorneys. But Bell refused, saying to do so would break FBI promised to informants that their identities would be kept confidential.

Bell's attorneys argued in Griesa's court earlier this week that contempt would be too severe a sanction and offered to accept lesser penalties.

But Griesa brushed aside the Justice Department arguments in his 68-page opinion. "No one can deny that it is a grave step to enforce a court order to the extent of holding the attorney general of the United States in contempt," he wrote.

"However, the issues in this case are grave in the extreme, involving charges of abuse of political power of the most serious nature," the judge said.

He called the informant files "a unique and essential body of evidence" and said that the use of a representative sample "must be established as a principle in the concept of this case."

Griesa said the issues of the case "relate to the most fundamental constitutional rights, which lie at the very foundation of our system of government - the right to engage in political organization and to speak freely on political subjects, without interference and harassment from governmental organs."

SWP National Secretary Jack Barnes greeted Griesa's ruling as "a milestone in the fight to uncover the truth about FBI political spying." He called Bell's refusal to turn over the files "part of the government's continuing cover-up of the criminal acts of the FBI's secret army of stool pigeons and provacateurs."

President Carter should direct Bell to comply with the court order, Barnes said.

Leonard B. Boudin, attorney for the SWP, said in a phone interview yesterday that he was satisfied with the ruling. He said he thought the attorney general deserved what he called the one-week "cooling off" period because "he's a latecomer to this and is making his stand for obvious protocol reasons," improving moral at the FBI."

If the attorney general fails to comply by next Friday, Boudin added, he will immediately refile his motion that Bell be jailed.

Contempt citations are punishable by fine or imprisonment until the person purges himself by complying with the court order. Boudin has argued that only jail is adequate "coercion" for the attorney general because a fine would mean the government was paying the government.

In his ruling yesterday, Griesa pointed out that civil contempt would "in and of itself, be a severe sanction against the highest law enforcement officer in the United States."

But the 47-year-old judge added that if Bell does not now comply, he will "entertain a motion for more drastic sanctions."

The legal battle over the informant files has developed in the past year into a procedural fight. The Justice Department appealed Griesa's original May 1977 order for the files. But the effort was turned down on the technical grounds that the "discovery" order simply was not reviewable because it was not a final order.

In April, Bell took his argument to the Supreme Court, which also declined to review the order. In refusing to comply even then, Bell contended he was merely preserving his right to have a review on the merits of his position, instead of on a technicality.

Griesa said yesterday no such review is proper, but it appears likely Bell would attempt to get one.