Breaking new ground in immigration law, a federal judge here today ruled that the federal government must grant excludable aliens some of the constitutional safeguards enjoyed by American citizens.

U.S. District Court Judge Marvin H. Shoob ordered the government to grant review hearings to 1,500 Cubans held in a maximum security prison here in "a reasonable time" or release them.

Many of the Cubans, jailed for crimes allegedly committed back home, have been locked up for almost three years since their arrival on the 1980 Mariel boatlift.

Shoob upheld the government's right to detain excludable aliens, but said the Cubans were entitled to hearings, lawyers, to call witnesses, to appear before a neutral decision-maker and "to the presumption of innocence enjoyed by criminal defendants."

"The government carries the burden of proving that continued detention . . . is necessary . . . and must establish by clear and convincing evidence that a detainee, if released, will be likely to flee , pose a risk to national security or a serious threat to persons or property in the United States," Shoob said.

"The Department of Justice is pleased that the U.S. District Court in Atlanta upheld the attorney general's authority to detain undocumented aliens pending their exclusion from the country," said Thomas P. Decair, director of the office of public affairs for the Justice Department in Washington.

"We have maintained that those illegal aliens from Cuba who are dangerous must be held in custody. We will not release persons who will pose a threat to the community.

"However," Decair continued, "we do not agree with that portion of the court's decision that found fault with the government's procedures to review the status of Cubans held in custody.

"The department's current procedures to review the aliens' detention status are fair and effective."

The government has sought to deport some of the 1,050 prisoners along with others who have had hearings that have held them "deportable under final orders of exclusion," but Cuban President Fidel Castro has refused to accept them.

Lawyers for the Cubans hailed the decision as a "major victory, a landmark decision."

"This is the first time a federal judge has ruled that excludable aliens have some of the same constitutional rights as American citizens," said Dale Schwartz, an Atlanta lawyer who filed the class action lawsuit for the Cubans.

Justice Department officials said they would study the ruling before deciding whether to appeal.

The government contended in the suit before Shoob that the 1,050 Cubans in jail here are dangerous and include rapists and murderers. But there are many who are not dangerous, Schwartz said, including those who admitted to crimes they never committed because they believed such acts would be regarded as political heroism against Castro.

Until now, lawyers for the Cubans had to prove their clients were safe enough to be paroled into everyday life pending further hearings. Of some 2,600 released by review panels, about 20 have been returned to the federal penitentiary here for parole violations, federal officials said.

"Our society has a fundamental interest in treating all persons with basic fairness, because to do otherwise is contrary to the most cherished principles on which this nation was founded," Shoob wrote in his 73-page order.

"Society has at least an economic interest in avoiding the high costs of incarcerating aliens who pose no realistic threat of criminal behavior and who might otherwise play a productive role in the economy," he said.