A measure approved by Montgomery County voters by a 2-to-1 margin Nov. 7 banning landfills from property zoned for residential use is invalid, according to an opinion by the county attorney.

Although the opinion, by County Attorney Richard S. McKernon, would not be binding on a court of law that might be asked to decide the validity of the measure, it apparently clears the way for selection of a garbage dump site in Laytonsville, which could come within a few weeks.

McKernon said in a message to County Executive James P. Gleason that the landfill measure - an amendment to the county charter that grew out of intense controversy over proposed dump sites - is unlawful because it conflicts with state laws vesting zoning powers with planning commissions, county councils and boards of appeals.

It "represents an unlawful and invalid attempt to effect a change in the zoning ordinance,"McKernon said.

Newly elected State Del. Robin Ficker (R-Montgomery), author of the charter amendment, promptly labeled the opinion an "intimidating act . . . by a lame-duck administration . . . If I were the county's attorney, I would go to court to seek an interpretation first, otherwise, the county risks substantial civil suits for damages" upon proceeding with a landfill on residentially-zoned property, he said.

For more than four years, Gleason has been looking for a site for the trash dump to replace the Rockville Gude landfill, which will be filled in 1981. After reviewing more than two-dozen sites, Gleason settled on two locations, in Potomac and Rockville, but the Potomac location (now the site of a proposed new sewage treatment plant) was ruled out by the state health department.

Both locations are on residentially zoned land.

Although Gleason has not publicly announced his choice of the Laytonsville site, his aides have conceded it is his only option if he wants to decide the matter by the time he retires Dec. 4.

Before he leaves office, Gleason hopes to extract a pledge from the incoming County Council to back construction of a mammoth trash recycling facility - probably in Gaithersburg - that would reduce dependency on landfills in the future.

If he is satisfied that the new council will proceed with the "central processing facility," as it has been called, Gleason will leave the trash problem to incoming executives Charles W. Gilchrist, aides said.

Gleason and the seven-member council, which will have four new members, have scheduled a meeting for today to discuss the trash problem.

Gleason has said that a recycling facility will require only a small garbage dump, primarily for backup purposes, rather than the mountains of trash now collecting at a rate of 1,000 tons a day at the Gude landfill.

The county already owns land at Shady Grove Road and Rts. 355 (Rockville Pike) in Gaithersburg available for the recycling facility. If work were begun immediately, it could be ready by 1981.

Gleason's staff has defended its choice of residential land for the landfill partially because it is cheaper. The staff also has said that alternative industrial locations studied have failed to meet soil and truck access considerations.

Ficker yesterday challenged the timing of the county attorney's opinion. "It's pathetic they didn't say a word before the election. They certainly were quick to come out against TRIM," the tax-cutting charter referendum that lost, he said.

"Their actions result in a chilling effect for anyone who wants to go through the legitimate process of amending the county charter," Ficker said.

County Executive-elect Gilchrist, who was unenthusiastic about new landfills during his campaign, has declined to state his position on the subject, but he has indicated that he will appoint a new county attorney, who would have the option of considering other course of action.