The first test of controversial Virginia law that makes it a crime to employ illegal aliens ended yesterday when a Fairfax County judge dismissed charges against Reston restaurateur George Bilidas.

General District Court Judge Michael S. Horwatt ruled that Bilidas, owner of the Lake Anne Inn, did not knowingly commit an offense by employing for more than a year an EI Salvadorean cook who lacked proper immigration papers.

The case, the only one brought under Virginia's year-old law, was regarded by state officials as an important test of their ability to curtail the employment of illegal foreign workers in Virginia.

"I'm very sorry because that was a precedent," said Martha Brayton, director of the Virginia Labor Law Administration, when told of the decision yesterday. As a result of illegal foreign workers, Brayton said, "Many of our citizens are losing out in many ways."

Legal sanctions against employers have been advocated repeatedly by politicians and interest groups concerned with the growing problem of illegal aliens who are entering the United States each year by the hundreds of thousands.

Several such proposals have been put before Congress, including one by President Carter last year that would have levied a maximum fine on a business of $1,000 for each illegal alien it employed. But none of the measures have been able to pass the Senate.

The proposed sanctions have been vehemently opposed by various Latino organizations, which contend that undocumented foreign workers do not take jobs away from U.S. citizens. The groups also express fears that employer sanctions will lead to increased discrimination against Hispanics since the vast majority of illegal workers come from Latin America and superficially are indistinguishable from Spanish-speaking citizens.

In the absence of federal sanctions, however, about a dozen states including Virginia have passed laws against hiring illegal aliens, a spokesman for the U.S. Immigration and Naturalization Service said yesterday. Several others, including the District of Columbia, have seriously considered such measures.

But the INS opposes such state laws, the spokesman said, because the state authorites do not have the expertise to enforce them. "They don't know who is an undocumented alien and who isn't," he said.

Bilidas' lawyers, Michael E. McKenzie and Jack Wasserman, have noted what they regard as the "Catch-22" aspects of the Reston case. Though scores of illegal aliens were arrested by the U.S. Immigration Service in the tobacco fields of southern Virginia last fall, none of the farmers who employed them were prosecuted.

Bilidas had applied for a labor certification in an effort to make his cook, 42-year-old Mauro Portillo, a legally documented worker. It was on the basis of this application, his lawyer said recently, that charges were brought against Billidas.

The judge yesterday called Bilidas' efforts to obtain the certificaion a "good faith attempt" and noted that last Wednesday the U.S. Labor Department gave Portillo permission to work in the United States.

Bilidas was clearly happy about the court's decision yesterday, which could have cost him $1,000 and a year in prison if it had gone the other way. "I'm elated, just elated," he said before accompanying his legal team to another of his restaurants, the Amphora in Vienna.

Alex Y. Mutch, the Virginia Department of Labor and industry investigator who had ordered Bilidas arrested in October, shook hands with the beaming restaurateur and clapsed his shoulder after the verdict.

"We would like to have seen it won," Mutch said, "but I'm not unhappy. I've been out to eat at his place... He has a problem getting help."