The federal Youth Corrections Act, a measure that enabled younger offenders to receive special treatment in District of Columbia courts, was repealed yesterday in a move that appeared to come as a surprise to several city officials.

The act permitted hundreds of D.C. offenders under 22 years of age to be placed in job programs and kept them apart from hardened criminals. For the past 30 years it had provided job-skill training and permitted imposition of lighter sentences on qualified defendants.

Repeal was part of a package of crime measures which had been long under consideration. In recent days the package was attached to a package of federal spending legislation that was passed by Congress Thursday and signed by the president yesterday.

The speed with which the long-discussed crime measures finally moved to enactment appeared to take some officials unawares.

Judge Fred B. Ugast, chief of the criminal division of D.C. Superior Court, said "we were taken by surprise that this crime bill . . . would be enacted at this time."

The change raises questions about the city's ability to cope with new prisoners in its overcrowded corrections facilities, where 654 offenders are currently serving Youth Act sentences in compounds separate from older prisoners.

Ugast said judges yesterday were still trying to figure out which defendants would be affected.

The Youth Act had allowed judges in D.C. and in federal courts nationwide to impose indeterminate or open-ended sentences on young offenders, ranging from probation to 20 years in prison with immediate eligibility for parole.

Those who completed training programs had their criminal records expunged.

Repeal of the act means that sentenced offenders here and in federal courts will be sent to adult facilities with fixed sentences, regardless of their ages.

The change is not expected to affect current prisoners.

"It's an outrage," said Karen Koskoff, president of the Superior Court Trial Lawyers Association. "There are a lot of young people who benefit from the Youth Act and do not get in trouble again."

U.S. District Court Judge Charles R. Richey, a former chairman of the American Bar Association's sentencing committee, called the action "a tragic mistake . . . . I don't mind telling you I'm sick about it."

Some federal officials, including those in the Justice Department, said the change was necessary. They said there was too much disparity in the way judges sentenced and the crimes being committed by eligible offenders have become more serious.

"It's a very welcome and long overdue change," said U.S. Attorney Joseph E. diGenova. "This is a return to truth in sentencing."

The repeal also abolishes the federal parole system and establishes a commission to propose new sentencing guidelines for federal judges within 18 months.

The repeal follows a growing movement against indeterminate sentences.

"The main reason the Youth Act fell by the wayside was the same reason indeterminate sentencing fell by the wayside," said Kenneth Feinberg, former special counsel to the Senate Judiciary Committee. "The open release date has been emphatically rejected by the Congress in a bipartisan way."

Federal Prisons Director Norman Carlson said Youth Act sentencing has fallen under increasing disfavor among federal judges. The number of offenders incarcerated under the act peaked at 1,901 in 1976, he said, and fell to 601 last year.

But Judge Ugast said the act "was an option that was used substantially by the judges over the course of each year, particularly in misdemeanor cases. I feel there's a place for that option, with some changes."

Prosecutors yesterday estimated that as many as 60 percent of about 3,000 dispositions reached in felony cases in Superior Court last year involved offenders eligible for Youth Act sentences.

Corrections officials estimate the average time served for Youth Act offenders is just over two years.

Members of Congress were disturbed by a trend toward increasing violence among young offenders.