The federal law mandating speedy trials for criminal defendants has been ruled unconstitutional by a U.S. District Judge in Baltimore, setting up an appellate level debate long awaited by many judges and prosecutors.

Judge Joseph H. Young ruled that the act, which requires a trial within 90 days after arrest, was "an unconstitutional legislative encroachment on the judiciary" that violated the separation of powers doctrine of the Constitution.

Judge Young issued the ruling in the case of two men charged with heroin possession and distribution. Until appealed as expected, and upheld by a higher court, the ruling applies only in Young's own court.If adopted by judges in other jurisdictions, however, the opinion could serve as a precedent.

The Speedy Trial Act, passed by Congress in 1974, currently requires a defendant to be indicted within 45 days of arrest, arraigned within 10 days of indictment, and brought to trial within 90 days after arrest and 120 days after arraignment. Those time limits will be shortened when the act becomes fully effective in 1979.

The two defendants in the case before Young, James E. Howard, and Theodore Hartzog, both of York, Pa., claimed that their trial started more than 90 days after their arrest and more than 120 days after their arraignment. They asked that the case be dismissed or, alternately, that they be released from custody. Young dismissed their claims.

In the first place, he wrote, the defendants had, in fact, gone to trial within the time limits imposed by the Speedy Trial Act. Delays that the defendants and their lawyers had caused could not be counted in the 90- and 120-day limits, he said.

More importantly, he ruled, the defendants had no real grounds for complaint because the Speedy Trial Act itself could not be upheld constitutionally.

"There must be a line beyond which legislative action directed to the administration of judicial procedures becomes legislative control, and, as such, an unwarranted intrusion into the judicial system," he wrote.

Young criticized what he called the "deficiencies" of the Speedy Trial Act: "The burden which the time limits place on the federal district courts is heavy and the disruption severe. The limits . . . may, in various contexts be too short, and thus interfere with the quality of justice."

Young cited two examples in the past 12 months when he had granted separate trials in lengthy conspiracy cases to accommodate the Speedy Trial Act's requirements.

In a speech criticizing the Speedy Trial Act before the American Law Institute last year, Chief Justice Warren Burger cited a case where two foreign nationals indicted for funneling half a million dollars worth of illegal drugs into the U.S. were released because they were not brought to trial within the law's time limits.

The lawyer for one of the defendants, Hartzog, has already notified the court that he intends to appeal the ruling. Howard's lawyer said he would appeal the ruling only if his defendant is convicted. Their trial, and that of four other men, is now under way in Baltimore, where the men were allegedly caught receiving supplies from a heroin distributor.

Chief Judge Edward S. Northrop of the U.S. District Court in Maryland said the court would still operate under the SPeedy Trial Act "and will continue doing so until the Fourth Circuit (appeals court) says otherwise,' But he called the provisions of the law "onerous."

And Jervis S. Finney, U.S. attorney for Maryland, said his office will continue to follow the Speedy Trial Act rules. "It's been our position that no violation of the Speedy Trial Act arose in that case," he said.

Finney said that the main holding of the case was that the Speedy Trial Act had been complied with. The holding on the constitutionality of the act itself, he said, was not part of the "heart" of the decision.

The Sixth Amendment to the Constitution guarantees the right to a speedy trial. But the courts became so jammed during the late '60s and early '70s, and the trial delays grew so long, that proponents of the act in Congress felt that the right was effectively being denied.

A study by the Administrative Office of the Courts showed that many defendants had to wait as long as a year from the time of arrest before going to trial.

The bill was introduced by then Sen. Sam J. Ervin Jr. (D-N.C.) and, as enacted, set up a three-year phase during which the maximum period between arrest and trial would be gradually decreased.