Alarmed by a burgeoning arms-smuggling traffic and fearful that some of the weapons may fall into the hands of Greeks, the Constantine Karamanlis government has enacted one of the tighest antigun laws in Europe.

The law passed Tuesday makes the illegal import, transport or possession of weapons punishable with a prison term of up to 20 years.

The law is yet another by-product of Lebanon's bitter civil war. During the past 20 months. Greece's free ports of Salonika and Pireaus have been key conduits for gunrunners selling to the highest bidders in Africa and the Middle East.

Taking advantage of the ports' special status, under which goods delivered for transshipment may be stored in warehouses without inspection, the underground entrepreneurs of the once-flourishing Lebanese capital descended upon Greece en masse.

Their weapons come from Antwerp, aboard flagships of convenience, hidden inside the frozen carcasses of sheep. From Benghazi come crates of canned tuna with false bottoms. From Dusseldorf come new Mercedes in which are hidden machine guns, rocket launchers and grenades.

According to Greek officials, the government is determined to curb the "gunrunning godfathers," as they are described in the new law.

Operating from the teeming cafes of Piraeus, from the clubs and boites of Athens' old quarter, the wheeler-dealers exist in a closed subculture. One of the best sources of information available to Interpol and the intelligence agents eager to know where the arms are going, are the prostitutes who move freely about that milieu.

"And they've gotten bloody spoiled in the process," said a Greek-American bartender at a club once frequented by sailors from the U.S. 6th Fleet. "These blokes come in and pay top prices . . . and all they expect is talk."

Despite official concern with a growing wave of criminal and political violence, including two assassinations, firebombings of political party offices and newspapers, and a number of other armed attacks, there is no evidence that an appreciable amount of the weapons is remaining in Greece.

"What the Greek extremists are getting is a mere dribble," said one Western diplomat. "There's certainly a market with the monarchists, supporters of the fallen junta and the disaffected ultra left. But it's peanuts compared to the real volume, really only a matter of convenience for them. A Greek might get a couple of AK-47's, something off the top, by intervening to get people in customs or the port authority to expedite a shipment. Really, nothing more."

The real clients, the source continued, are the leading revolutionary groups, ranging from the Palestine Liberation Organization to the Eritrean Liberation Front in Ethiopia. They include dissident groups in the Persian Gulf states and Africa. According to authoritative sources, the traffic in some cases reaches into South Asia and beyond to Thailand and Burma.

One estimate is that every month tens of thousands of weapons move every month through Salonika and Piraeus. And one of every 10 trucks entering Greece from northern Yugoslavia, according to the estimate, carries, in addition to its legitimate cargo, illegal weapons or illegal drugs.

At least 10,000 weapons have been confiscated since last January, 10.7 tons of hashish was found aboard a Cypriot freighter on Jan. 8. The ship's captain, Nicholas Nanthopoulos, said the drugs had been loaded in the Christian port of Jounieh, Lebanon, and were destined for Antwerp to be exchanged by Lebanon's rightist militia for arms.

"What's been confiscated is a drop in the bucket," said a Western official. "Everything they've discovered has happened by chance . . . So, multiply what's been detected by several thousand and you've got a small idea of the dimension of the traffic here."

The first indication that Greece had become a channel for weapons came last January when authorities were investigating the assassination of the CIA station chief, Richard Welch. In a small apartment in fashionable Kolonaki, they discovered a small arsenal of arms. They belonged to Hippocrates Savvouras, a monarchist who was then a member of Parliament on the ticket of Premier Karamanlis.

Some weeks later, two parliamentary candidates from the radical socialist party, Pasok, were interrupted as they tried to hide seven automatic rifles, a rocket launcher and some ammunition aboard a car ferry leaving the island of Chios. The arms bore Arabic inscriptions and, according to authorities, were part of a Syrian shipment diverted to Pasok.

In April, thousands of guns were discovered in a well in the southern Peloponnesus mountains. Five months later, 1,800 Mauser rifles were confiscated aboard a Cypriot vessel at the island of Euboea.

Denying that there was any reason to suspect that the arms were destined for Greece, Merchant Marine Minister Alexandros Papadongonas groaned: "The Greek seas are simply a corridor for the vast arms trade going on in the eastern Mediterranean and the Middle East."