A Fairfax County Circuit Court judge, handing a major setback to supporters of low-income housing in the Virginia suburbs, has ruled that the county cannot issue up to $50 million in bonds to pay for subsidized apartments that could also be rented at market rates to middle-income families.

Judge Lewis H. Griffith said that under Virginia law the Fairfax County Redevelopment and Housing Authority is prohibited from issuing tax-exempt bonds to finance housing projects in which only 20 percent of the units would be rented to low- and moderate-income families, lawyers for the agency said yesterday. The ruling is believed the first Virginia court test of a new federal program that allows states to grant housing authorities the power to sell tax-exempt bonds to build subsidized housing.

The decision is likely to escalate political controversy over public housing in Fairfax since it follows citizen opposition last summer that stopped a subsidized housing project in Springfield. Housing officials said they have not decided whether to appeal the case.

"I see it as a major disappointment for the housing authority," said Gerald W. Hopkins, authority chairman. "You can't keep the rents low enough to pay finance charges and maintenance at today's interest rates and still serve low- and moderate-income families . . . . We wanted to have higher income residents help subsidize the low-income ones."

Griffith's ruling, delivered from the bench on Tuesday, also will prevent the agency from renovating about 1,000 apartment units along the Rte. 1 corridor in Hybla Valley and Rte. 7 near Baileys Crossroads, a spokesman for the agency said.

Housing officials predicted that the court decision would further hamper their efforts to build more low- and moderate-income housing in the county, programs that have already been hurt by high interest rates and Reagan housing fund cutbacks. There are 500 public housing units and several thousand other units indirectly subsidized by the state or federal government in Fairfax.

Several federal housing officials expressed surprise about the court ruling. "I've never heard of that happening before," said Linda M. Murphy, director of the Office of State Agencies and Bond Finance at the Department of Housing and Urban Development. "Under federal law you must reserve at least 20 percent of units for low income, but, of course, states can pass enabling legislation to modify the law."

"I'd say its a little unusual," said Mike Milton, a lawyer in the same office. He said the District and Maryland permit housing in which only a portion of the units go to low- and moderate-income families. Virginia's law, however, does not specify what percentage of the units must go to low- or moderate-income residents, said lawyers for the county authority. They said Griffith's ruling means that in Virginia literally all of the bond money must go to low- or moderate-income housing.

Members of the Fairfax County Taxpayers Alliance and lawyers and citizens who had mounted the legal challenge against the housing agency after spotting a newspaper notice last October were jubilant with the decision.

"The taxpayers have won a great victory," proclaimed James Roncaglione, president of the 26-year-old county taxpayers group. "I think the decision will make the RHA much more responsible in the future . . . . They were like a loose cannon rolling around on the deck."

"From this time on, the Board of Supervisors are on notice that the citizens in this county want some oversight exercised over RHA," said Steve Armstrong, the group's lawyer.