Homeowners and their local governments have the right to sue real estate agents for steering customers into neighborhoods on the basis of race, the Supreme Court ruled 7 to 2 yesterday.

If such steering actually begins "to rob a [municipality] of its racial balance and stability, [it] has standing to challenge the legality of that conduct," the court said.

Similarly, racial steering gives residents standing "to protest the intentional segregation of their community," Justice Lewis F. Powell Jr. wrote in the opinion for the majority. He returned to the bench Monday after convalescing at home from surgery in March.

The decision, involving the Village of Bellwood, one of the few Chicago suburbs with a signigicant and growing black population. is the second in seven years to enchance enforcement of the Fair Housing Act of 1968, which seeks to prevent racial bias in sales and rentals.

In 1972, the court held that the law gave standing to residents of a large apartment complex in San Francisco to sue the owner, Metropolitan Life Insurance Co., for maintaining a "white ghetto" because exclusionary practices stigmatized them and deprived them of the social and professional advantages of living in an integrated community.

Yesterday, Powell said that for the purpose of determining standing, "we perceive no categorical distinction between jury suffered by occupants of a large apartment complex and that imposed upon residents of a relatively compact neighborhood such as Bellwood."

The case began in 1975 when five Bellwood residents, four whites and one black, and a black resident of adjacent Maywood, agreed to act as "testers" who would pretend an interest in buying suburban homes through two brokerage firms, Gladstone Realtors and Robert A. Hintze Realtors.

The testers said that the blacks among them were steered toward an integrated area of Bellwood approximately 12 by 13 blocks in dimension and away from predominantly white areas. By contrast, they said, the whites were steered away from the integrated area, in which the black testers reside.

The testers and Bellwood then went into U.S. District Court to accuse the firms and nine of their employes of having injured the village by "wrongfully and illegally" manipulatong its housing market "to the economic and social detriment of the citizens . . ."

The two separate complaints relied on the 1968 law's section 812, which provides discrimination "may be enforced by civil actions in appropriate United States district courts."

The trial judge dismissed the complaints on the ground that section 812 gives standing only to those injured by the alleged discriminatory acts, unlike section 810-the basis of the Metropolitan Life decision-which specifies that and action may be brought by a "person aggrieved."

The 7th U.S. Ciruit Court of Appeals reversed him, holding that sections 810 and 812 are laternative remedies available to precisely the same class of plaintiffs-persons who have shown actual or threatened jury resulting from alleged illegal housing discrimination.

In the opinion affirming the 7the Circuit, Justice Powell wrote: "Nothing in the language of section 812 suggests that it contemplates a more restricted class of plaintiffs than does section 812." And, he said, the realty companies "have identified nothing in the legislative history contrary to this view."

In the dissenting opinion, Justice William H. Rehnquist wrote: "I think that the court's decision ignores the plain language of section 812 and makes nonsense out of [the law's] formerly sensible statutory enforcement scheme."Justice Potter Stewart concurred.