A federal judge yesterday blocked the Department of Defense from denying security clearances to two Vietnamese-American employees who became naturalized U.S. citizens after fleeing communist rule in Vietnam.

U.S. District Court Judge Thomas F. Hogan granted a preliminary injunction against enforcement of a provision in the Pentagon's new "Personnel Security Program" that governs access to material that has been classified top secret, secret or confidential.

The regulation bars access to classified information to any naturalized citizen who originally came from one of 29 countries judged to have interests "adverse to the United States" unless that individual has been a citizen for five years.

Vietnam, Cuba and the Soviet Union are among the 29 nations designated as hostile to the United States. China is not, although defense officials have submitted documents in the security clearance case indicating that it will soon be added to the list.

The Reagan administration, in opposing the injunction, has said that enjoining the Pentagon from enforcing the regulation would harm national security.

The plaintiffs, Phong T. Huynh and Vien U. Huynh, are siblings who fled Vietnam separately by boat in 1978. Their lawsuit, filed in December, accuses the Pentagon of violating their constitutional rights by denying them security clearances "solely on the basis of their national origin."

A plaintiff motion is pending to add a third individual to the suit and to have it certified as a class action case on behalf of other similarly situated Pentagon-affiliated workers and contractors.

The regulation went into effect in January 1987 in the wake of several notorious espionage cases, including those of retired Navy warrant officer John A. Walker Jr. and CIA employees Larry Wu-Tai Chin and Karl Koecher, both naturalized Americans.

The Huynhs spent several months in a refugee camp in Malaysia before settling in the borough of Queens in New York in 1979 and became naturalized citizens in 1985. They are now employed at the Naval Surface Warfare Center in Dahlgren, Va., and they say their jobs at the weapons research facility have been jeopardized because they do not have access to classified material.

"After all I have gone through to become a United States citizen, that really hurts," Phong Huynh said in a statement.

The administration argues that Phong Huynh had an interim security clearance at the time the security program went into effect and is not affected by the new regulation. His sister, according to the government, is expected to receive "limited access authorization at the secret level" soon.

The regulation provides that a person who has been a resident of the United States for 10 years may be granted a clearance, even if he or she has been a citizen less than five years.

But the Huynhs' attorney, Philip Le B. Douglas, said yesterday that the security clearance regulation allows exceptions only if "a compelling need" exists and that his clients fear for their jobs and careers. Before the lawsuit was filed, he said, a top naval center official had suggested to both Huynhs that they look for new jobs.

Douglas said the last time there was such discrimination against naturalized citizens was during World War II when Japanese Americans were sent to internment camps "because we thought Japan would be landing in Malibu."

In issuing an oral opinion from the bench, Judge Hogan gave the government more time to present further arguments in its defense, but said he thought the Pentagon ought to reconsider the new regulation.