The Montgomery County Council voted yesterday to ban the sale of ammunition to owners of unregistered guns, making it the latest jurisdiction to join a growing nationwide drive for local control of handguns.

The Montgomery law, passed by a surprisingly strong 5-to-2 vote over the advice of the state attorney general and the county attorney, prohibits county ammunition dealers from selling bullets to any buyer who cannot produce either a valid Maryland registration certificate for his gun, or in the case of out-of-state residents, proof that the gun was lawfully purchased.

Maryland law preempts local jurisdictions from regulating handguns, Attorney General Stephen H. Sachs and County Attorney Paul A. McGuckian had reminded the council. Moreover, local gun control laws passed in San Francisco and Berkeley, Calif., were overturned when courts ruled that California law preempted them.

Montgomery Council President David L. Scull acknowledged yesterday that Sachs was opposed to the bullet bill as being a back-door attempt at handgun regulation. But Scull noted that Rockville lawyer Roger Titus, who represents the village of Friendship Heights, predicted the law would be upheld in the courts.

"I find Mr. Titus' memorandum carefully researched and more persuasive," said Scull, who is also a lawyer. "This is a sensible, useful step of genuine value to crime-solving, which we should not shrink from taking."

Council member William E. Hanna Jr., who voted for the bill as "more or less a symbolic gesture," added that the attorney general had been wrong in the past on questions of state law preempting local law.

Introduced a year ago by Scull, the bullet bill became a matter of intense debate, with opponents saying the bill was the first step toward gun confiscation and supporters praising it as a statement against gun use.

Yesterday, Scull and other supporters said the Montgomery law could continue the nationwide impetus for local gun laws that began when tiny Morton Grove, Ill., northwest of Chicago, passed the nation's toughest gun law in July 1981.

The Morton Grove law, which bans the sale and possession of handguns in village limits, has been upheld by four state and federal courts.

"Communities are starting to pass their own gun control laws because of inaction at the state and national level," said Rex West, field coordinator of the National Coalition to Ban Handguns. "On the national level, politicians in Congress are still afraid of the NRA National Rifle Association . On the state level, again, the gun lobby carries quite a bit of weight."

Until yesterday, the District was the only local jurisdiction with any law relating to handgun registration.

Since former Gov. Marvin Mandel pushed through the state's gun law in 1972, Maryland has required dealers to register all new gun sales with the State Police. That law does not cover sales made between individuals, or sales made before 1972, although the police have asked gun owners to voluntarily register their weapons.

Scull said his ammunition bill was designed to encourage Montgomery residents to register their guns. He said that regulating bullets, and not guns, might allow the county to bypass the state prohibition.

But gun control opponents, and even some supporters, disagreed. "It is illegal," said John Aquilino, director of public education for the National Rifle Association. "It is clear that the intent is to enforce registration of rifles and handguns, and this is clearly, clearly in contravention to the state's preemtion law."

At the opposite end of the spectrum of opinion, Barbara Lautman of Handgun Control Inc., a gun control lobby group based in the District, said, "It's important to see the council voting for something to expand handgun control. But these local ordinances, despite their symbolic importance, just aren't going to hold up." She said her group is concentrating on a tougher statewide measure.

Some Montgomery gun dealers were dismayed yesterday, but said they would have to study the bill before deciding what, if any, action to take against it.

"The bill is just idiotic," said Steve Schneider, owner of Atlantic Guns Inc. in Silver Spring. "If I were a private citizen and not a dealer, I'd just go over to Frederick or Prince George's county to buy my ammunition."

Later yesterday, the council rejected a resolution passed by the Friendship Heights Village Council to ban the possession of bullets inside the borders of that tiny hamlet on the District's western boundary. County Council members, whose approval was necessary for the resolution to go into effect, said the village ordinance went too far.