A federal judge in Alexandria refused the government's request yesterday for an immediate ruling that a former Central Intelligence Agency officer had violated his contract with the agency by publishing an unauthorized book detailing the 1975 fall of Saigon.

Instead, U.S. District Court Judge Oren R. Lewis hinted that the case may go to trial and gave the government and the former agent two months in which to collect evidence.

The suit filed by the government alleges that the agent, Frank Snepp, violated a secrecy agreement with the CIA by publishing the book "Decent Interval" without first submitting it to the agency for review. The government has not addressed the issue of whether secret information is contained in the book, but it is seeking to recover the money Snepp has made from the book's sales.

Attorney General Griffin B. Bell said in February that the Carter administration sees the case as a test of the validity of the secrecy oaths employes are required to sign before joining the CIA. "If you enter into a written, solemn contract and breach it, that's a serious matter," said Bell. The attorney general added that if such contracts are not valid, "We might as well know it."

The legal precedent for the case involves the book "The CIA and the Cult of Intelligence" by Victor Marchetti and John D. Marks. In that case, the 4th U.S. Circuit Court of Appeals upheld the government's contention that the secrecy oaths are constitutional but restricted their decision to cover only classified information.

Thomas Martin, a deputy assistant attorney general in the Justice Department, argued that the Marchetti and Snepp cases are similar, and that since Snepp has admitted signing the contract and has also stated he did not submit the book for approval before publication he should be found guilty of breach of contract.

Snepp's attorney, Mark Lynch contended yesterday that the two cases are different because in the Marchetti-Marks book the government was able to show that classified information had been published. This has not been the case with Snepp's book, said Lynch.

Lynch also said an agreement of termination Shepp signed when he left the agency modified the original contract so that only material classified as secret had to be submitted for clearance by the agency before it could be published.

In the book, published last fall, Snepp charges that major intelligence failures contributed to the chaotic evacuation of Saigon and that because of this thousands of Vietnamese loyal to the United States, some of whom had worked for the CIA, had been left behind.