The Supreme Court ruled 5 to 2 yesterday that employers and unions without proven histories of discrimination may adopt racial quotas to overcome imbalances in training and promotion programs.

The court upheld affirmative action aimed at "conspicuous" or "manifest" racial imbalance in job categories that traditionally have been segregated.

It rejected the claim of white Louisiana factory worker Brian F. Weber that he was a victim of illegal "reverse discrimination" when he was turned down for an in-plant craft-training program opened to blacks and whites on a one-for-one basis.

The court emphazied that its holding was "narrow" - the Civil Rights Aact of 1964 does not forbid racial preferences of the kind in the temporary affirmative-action plan agreed to by Weber's union and employers, United Steelworkers of America and Kaiser Aluminum & Chemical Corp.

"We need not today define in detail the line of demarcation between permissible and impermissible affirmative action plans," Justice William J. Brennan Jr. wrote for the court.

But wide as well as narrow implications for thousands of employers and for millions of workers - blacks and other minorities, whites and women - were perceived in the first wave of reactions.

Eleanor Holmes Norton, head of the Equal Employment Opportunity Commission, said the ruling could bring a relaxation of EEOC affirmative-action guidelines, which require some proof of past employment discrimination before corrective programs can be required.

The AFL-CIO, which had supported its affiliated union, was jubilant. "A big victory," spokesman Al Zack said.

By contrast, a lawyer who filed a pro-Weber, friend-of-the-court brief saw "a very limited sanction . . . of a numerical approach under grievous circumstances."

"Private employers may read the decision as sanctioning racial quotas, but if they do, they're going to be in a lot of trouble," said the lawyer, Larry M. Lavinsky of the Anti-Defamation League of B'nai B'rith.

NAACP executive director Benjamin Hooks termed the ruling "probably the most important civil-rights decision in recent history." If the court had ruled for Weber, he said, "it was our prediction that the cause of affirmative action would have been set back 10 years."

For the Mexican-American Legal Defense and Educational Fund, President and general counsel Vilma S. Martinez said that the ruling is momentous for Hispanics, "soon to be the nation's largest minority." It gives them "the means to open doors that have been closed . . . too long," she said.

National Women's Political Caucus leader Mildred Jeffrey said, "We are thrilled . . . With this decision, women and minorities come closer to making equal opportunity in employment a reality instead of a dream."

In New Orleans, Weber, 32, said, "To say the least, I'm very disappointed . . ." He added, "I think we fought a good fight." That was implicitly acknowledged in the opinion for the court.

Weber's key argument, that the 1964 law's Title VII barred all race-conscious affirmative action plans, "is not without force," Brennan wrote.

Weber said he plans to return to work at 7 a.m. today at the Kaiser plant in Gramercy, La. It was one of 15 Kaiser plants around the country covered by the affirmative-action plan negotiated in 1974 by the steelworkers. Weber, a laboratory worker, is a member of the union.

Because the Weber case affects the workplace, it generally has been regarded as more important to more Americans than the more widely publicized case of Allan P. Bakke, the white applicant for admission to a medical school who was turned down because 16 of 100 slots had been reserved for minorities.

A year ago, the court ruled 5 to 4 that the University of California had to admit Bakke, but that race could be taken into account to overcome past discrimination.

Justice Lewis F. Powell Jr. wrote the controlling opinion in the Bakke case, which, because it involved actions by a state rather than the private sector, was decided on constitutional rather than statutory grounds.

Powell did not participate yesterday because he was absent for surgery when the Weber case was argued March 29.

Justice John Paul Stevens had disqualified himself, without explanation, at the outset.But the Associated Press said it learned that his reason was that, as a lawyer in Chicago, he had represented Kaiser Aluminium.

The two abstentations created the possibility of the case's being decided by a majority of four justices - fewer than half of the members of the court. A ruling by such a majority is, in addition, vulnerable to a new challenge and even to reversal.

Three of the justices who joined Brennan yesterday, Byron R. White, Thurgood Marshall and Harry A. Blackmun, comprised the block of four who, in the Bakke case, had wanted to go further than Powell. The quota system at the state medical school was permissible, they contended.

Yesterday's dissenters, Chief Justice Warren E. Burger and William H Rehnquist, were, along with Stevens, in an opposing block of four that had wanted Bakke admitted but stopped short of Powell's position. The 1964 law, they contended, excluded race altogether as a basis for excluding anyone from a federally funded program.

The fourth member of the pro-Bakke block was Justice Potter Stewart. If Weber were to lose by a decisive 5-to-2 vote, Stewart's vote would be indispensable. He provided it. The opinion for the court emphasized the approach that both he and Brennan had taken in oral argument.

The tone of the dissenting opinions was harsh, even sarcastic, about the majority's reading of the language and legislative history and intent of Title VII.

Rehnquist, whose opinion was signed by the chief justice, credited the majority with a "a tour de force reminiscent not of jurists . . . but of escape artists such as Houdini . . ."

Burger spoke of "the 'good result' achieved by judicially unauthorized or intellectually dishonest means on the appealing notion that the desirable ends justify the improper judicial means."

Similar counter-charges were made simultaneously in a dissent in an unrelated case by Marshall. He accused Rehnquist of "disregarding the clear legislative history, structure and effect" of a welfare law. Rehnquist wrote the opinion for a 5-to-4 majority including Burger.

The Weber case was rooted in two historic, interwoven patterns: craft unions excluded blacks, and Kaiser, like other companies in the South, hired for craft jobs only workers with craft experience.

As a result, the Gramercy plant had only five skilled blacks - 1.83 percent of the total craft workforce of 273.

Under the 1974 agreement with the union, Kaiser agreed to start training its own unskilled production workers, black and white, for the first time, and to reserve 50 percent of the openings for blacks. The workforce in the town was 39 percent black.

The plan did not require whites to be discharged and replaced with blacks. It created no absolute bar to the advancement of whites, who previously could get craft jobs only if hired from the outside.

It was "not intended to maintain racial balance, but simply to eliminate a manifest racial imbalance," Brennan wrote. Moreover, he emphasized, the plan is temporary: it "will end as soon as the percentage of black skilled craft workers in the Gramercy plant approximates the percentage of blacks in the local labor force."

In the first year of the plan, Kaiser selected seven black and six white production workers for training. The most junior black, however, had less seniority than several whites who had been rejected, including Brian Weber.

The whites then filed a class action suit alleging a violation of Title VII, which in various sections forbids discrimination against "any individual" because of his race.

U.S. District Court Judge Jack M. Gordon, after a one-day trial in which he heard four witnesses and admitted seven exhibits and a short stipulation, ruled for Weber.

A divided 5th U.S. Circuit Court of Appeals affirmed in November 1977, thereby chilling adoption of new voluntary affirmative-action plans and enforcement of some existing ones, according to the steelworkers union.

The case then was brought to the Supreme Court in petitions filed separately by the union, the company and the Justice Department, which represented the EEOC.

Kaiser, without admitting past discrimination, admitted that it could be liable to lawsuits. That was the heart of the dilemma for many companies: they were willing to adopt affirmative action, but unwilling, because they could be sued, to admit past violations.

The government approved of the Kaiser-union plan, but on the grounds that it was what a court might order to remedy a past proven violation of Title VII.

Brennan, reading the bulk of his 13-page opinion from the bench, said, however, that, "We are not concerned with what Title VII requires or with what a court might order. . . . The only question" is whether Title VII prohibits "voluntary" affirmative-action plans such as those negotiated by the steelworkers union in the steel, aluminium and canning industries.

In oral argument the steelworkers union alone urged the position Brennan and Stewart seemed to welcome: Congress had intended to leave room for voluntary affirmative-action imbalances even if no litigation was threatened.

The counterargument that Brennan found "not without force" was the literal interpretation of the language in the law making it unlawful to "discriminate . . . because of . . . race."

But this overlooks significant points, he said in the opinion reversing the 5th Circuit.

If taken at face value, the language of Title VII would forbid all race-conscious affirmative action. But that would be completely opposed to the intent of Congress, which was to open employment opportunities to blacks, Brennan said.

"By going not merely beyond , but directly against Title VII's language and legislative history, the court has sown the wind," Rehnquist said in dissent. "Later courts will face the impossible task of reaping the whirlwind." CAPTION: Picture, BRIAN F. WEBER . . . "I think we fought a good fight"