Nicaraguan President Anastasio Somoza declared a state of siege today as battles with Sandinista guerrillas escalated in two major cities and a nationwide strike went into its third day.

Guerrillas were reported in control of large portions of Leon, Nicaragua's second-largest city 54 miles north of Managus, the capital.

Although local press reports said the Sandinistas had surrounded a National Guard garrison in Leon, Somoza said in a telephone interview that government troops had fought their way through guerrilla lines and were battling for control of the airport.

Heavy fighting also was reported in Matagalpa. Somoza said a troop convoy sent to relieve government forces there was ambushed four miles outside the north-central city. He said the besieged convoy was receiving National Guard air support.

Conflicting reports came from southern Nicaragua near the Costa Rican border.While Somoza claimed the guerrilla invasion there had been "contained" and was being "driven back inch by inch," the Sandinistas claimed to be marching north. roads leading to the area were closed by the National Guard.

A 300-strong guerrilla force attacked across the border last week, beginning what the Sandinistas said is the final offensive in their year-old war against the Somoza government.

The guerrillas have called for mass insurrection throughout the country in what so far appears to be an increasingly successful attempt to wage all-out war on a number of fronts. In the week since the offensive began, the Nicaraguan crisis has intensified much more rapidly than anticipated. Many Latin American countries now see a diminishing possibility that the rest of the Central American region will be able avoid participation.

Today, Somoza again accused a number of Latin American governments - including Costa Rica, Venezuela, Panama and Cuba - of arming and aiding the Sandinistas. At the same time, the Sandinistas have accused El Salvador and Guatemala of aiding Somoza, a charge denied by those governments. Each country in the region, at the very least, is monitoring the Nicaraguan situation closely.

Somoza said the state of siege went into effect this afternoon for 90 days. It allows arrests without charge, censorship and restriction of civilian movements. A state of siege was in effect here for nearly three years between 1974 and 1977 and again for 30 days last October following a monthlong outbreak of civil war.

Since that time, sporadic fighting has continued in almost every Nicaraguan city as the Sandistas trained and armed for a long-anticipated final push to overthrow Somoza. As part of that push, the guerrillas called for a nationwide strike to begin last Monday. Today, sources contacted in Managua by telephone said the city was completely closed down.

Transportation was limited to a few buses, most driven with a National Guard jeep escort, they reported.

While the government claimed that as many as 30 percent of business establishments in the capital were open today, observers said that the strike appeared more successful than a February 1978 work stoppage in which 90 percent of businesses shut down.

At least one of the four international airlines serving Managua, Taca, the Salvadoran national line, has indefinitely canceled scheduled flights there.

In a broadcast this week over Radio Sandino, a shortwave guerrilla station believed to be in Costa Rica, the Sandinistas threatened the security of any airliner flying into the country.

Following reports last week that at least two camouflaged aircraft, which the government said carried Sandinistas, were spotted in a northeastern Nicaragua combat zone, the government reportedly has prohibited all private planes from entering Nicaraguan airspace

Traveling on Nicaraguan roads has now become a risk taken by few except the National Guard and foreign journalists, who travel in convoys of rental cars to battle zones only to be turned back at government or guerrilla roadblocks.

With government and Sandinista claims and counterclaims difficult to verify, Nicaragua is full of unconfirmed rumors of foreign participation on both sides of the battle.

Last Wednesday, a Salvadoran Air Force Transport plane landed in Managua in full view of hundreds at the international airport and quickly taxied out of view behind hangars at the neighboring government air base that shares the runaway. News of the landing was broadcast immediately in every Central American country. The Salvadoran Foreign Ministry quickly broadcast its own denial of aid to Somoza, saying the plane had had mechanical difficulties on the way to Panama.

Costa Rica subsequently charged E1 Salvador's military government with intervention. In a statement published here today, El Salvador again said its only position in the conflict is the search for a "peaceful solution within the principles of international law."

Guatemala has denied similar charges, although informed U.S. sources believe that government may be serving as a conduit for arms shipments to Somoza from other countreis. In a statement yesterday, the Guatemalan defense minister said his army "has not intervene, nor will it intervene" in Nicaragua.

The Honduran military junta issued a similar statement.

While the Sandinistas shot down at least one National Guard plane last month Over Chinandega, there has been no confirmation of their charges that the plane was Israeli-made. Guerrilla sympathizers also have charged that two U.S. transport planes, traveling from a Panama Canal Zone airbase, landed this week in Puerto Cabezas, in northeastern Nicaragua.

The U.S. State Department denied the charged.

Somoza said today this National Guard has captured guerilla weapons he maintained came from "Panama, from Venezuela and some from Cuba." Earlier this week, Somoza threatened to invade neighboring Costa Rica, which his government says allows the Sandinistas to operate bases and launch attacks from its soil.

[Mexico, which broke relation with Somaza's government last month and called for its downfall, today said it was ready to take all necessary measures if Nicaragua carried out the threat to invade Costa Rica, Reuter reported.]

In the Organization of American States in Washington on Monday, a Nicaraguan request for measures against Costa Rica under an inter-America mutual defense treaty was turned down. The OAS instead decided to wait for a report from diplomatic observers it has had stationed on the Nicaraguan-Costa Rican border since last fall

Somoza said today that he would not attack Costa Rica until that report is issued. "We are content to wait," he said. "We are using the peaceful channels to straighten out the record." CAPTION: Map, no caption, By Dave Cook - The Washington Post