The Justice Department stepped into the espionage case against Air Force 2nd Lt. Christopher M. Cooke yesterday with an unprecedented petition seeking federal court endorsement of electronic surveillance that picked up his conversations with Soviet diplomats.

The petition for a ruling on the legality of the surveillances was filed in U.S. District Court in Baltimore. It followed a move by Cooke's attorneys to block use of the evidence in his court-martial at Andrews Air Force Base.

Justice Department officials said they expect an all-out assault by F. Lee Bailey, Cooke's chief defense attorney, on the 1978 Foreign Intelligence Surveillance Act, the law under which the surveillances were conducted.

The law, which has not been tested on constitutional or other grounds, established a secret court that issues warrants for electronic eavesdropping on agents of foreign powers here.

In an affidavit submitted with the petition, Attorney General William French Smith asked for secret court inspection, without the presence of Cooke's lawyers, of a sealed exhibit identifying "the targets of the electronic surveillances on which Lt. Cooke was allegedly overheard . . . and a copy of the transcripts of Lt. Cooke's alleged overheard conversations."

The sealed exhibit, Smith said, "provides more detail than the classified information previously furnished to Lt. Cooke and his defense counsel under protective order."

Even conducting an adversary hearing on the exhibit's contents, the attorney general contended, "would harm the national security of the United States."

In another affidavit, Lubomyr M. Jachnycky of the Justice Department's Office of Intelligence Policy, said the Air Force has provided Cooke's lawyers with "all transcripts of Lt. Cooke's overhearings, which the Air Force intends to use" at his court-martial.

Jachnycky said the FBI informed him Sept. 14 that it had found "additional overhearings of Lt. Cooke" and that copies of these were made available to Cooke's lawyers although the Air Force has no plans to use them. "These additional overhearings," the affidavit said, "are not the subject of any charges pending against Lt. Cooke."

The petition was filed in Baltimore because the jurisdiction of the federal court there includes Andrews where Cooke faces trial on charges of passing Titan II missile secrets to the Soviets over the past year.

Cooke, 26, former deputy commander of a Titan II crew, has been accused on three counts of espionage and 11 counts of unauthorized visits and phone calls to the Soviet Embassy and military mission here.

The military judge in the case, Lt. Col. David Orser, yesterday adjourned the proceedings indefinitely to await the outcome of the federal court petition.