A federal judge in Alexandria yesterday ordered former CIA officer Frank W. Snepp III to forfeit all the profits from his unauthorized book on the fall of Saigon to the U.S. Treasury.

Snepp also was barred from writing anything else about the Central Intelligence Agency without prior agency review.

The decision by U.S. District Court Judge Oren R. Lewis was not surprising because he had said after a two-day trial last month that he supported the government's position in its first test of the CIA secrecy oath.

Snepp's attorney, Mark Lynch, said yesterday that he will appeal the ruling.

Lewis ordered that a trust account be set up to hold the profits - an estimated $60,000 so far - from "Decent Interval," Snepp's critical account of CIA operations in the last days of the Vietnam war. Lewis' order does not affect profits earned by Random House, the publisher of the book.

Justice Department officials, who are to prepare papers outlining the trust and terms of the injunction, said yesterday the mechanics for handling the money are still to be worked out. But it is clear, they said, that the funds will go to the Treasury if Snepp's appeals fail.

Lewis said he assessed the damages because he found Snepp has "willfully, deliberately and surreptitiously" breached the screcy agreement he signed on joining the CIA in 1968.

That agreement requires agency review of any proposed manuscript to ensure classified information is not divulged.

White the government never contended that Snepp's book contained any classified material. Lewis said yesterday that Snepp "is not the judge of what portions, if any of CIA's intelligence may be made public."

The judge concluded that the unreviewed publication "caused the United States irreparable harm and loss. It has impaired the CIA's ability to gather and protect intelligence relating to the security of the United States of America."

Awarding nominal damages, as Snepp's lawyer argued, "would be nothing more than license to continue doing that which the law forbids," Lewis said. Snepp, he added, "ought not to be permitted to retain his ill-gotten gains."

Snepp told reporters outside the Alexandria courthouse yesterday that the government was welcome to the profits from his book. "It won't buy them back the honor the CIA lost in the final days of the Vietnam War," he said.

Robert L. Bernstein, chairman and president of Random House, denounced Lewis order yesterday, calling it a "bad joke."

He said the order showed that there are two classes of citizens: former high officials such as Richard M. Nixon and Henry Kissinger who can use secrets in their writings, and "legitimate whistleblowers" like Snepp who took pains not to compromise secrets yet still face gag orders.

Bernstein said he found it a "supreme ironys" that former CIA director Richard M. Helms was fined $2,000 for lying to Congress while Snepp has had $60,000 impounded for telling the truth."

Lewis' proposed injunction against Snepp is not as severe as one in effect against Victor Marchetti, another former CIA official who published an earlier book about the agency. He is forbidden to speak or write about the CIA without prior agency review.

Marchetti went to court to contest agency deletions in his book, "The CIA and the Cult of Intelligence." The Snepp case is the first time the government has gone to court to test the legitimacy of the CIA secrecy oath.

Snepp lawyer Lynch said yesterday that he will base his appeal on the grounds that Snepp did not violate the terms of the agreement he signed on leaving the agency in 1976 and on the constitutional grounds that a person cannot sign away First Amendment rights.

The later secrecy agreement states there shall be no disclosure of classified information or any information not already made public. The government acknowledged Snepp had sone neither in his book.