Machine-gun fire and the blasts of rocket-propelled grenades echoed through the dusty alleys of working-class neighborhoods in El Salvador's capital today as leftist guerrillas continued coordinated hit-and-run attacks in what appeared to be their first concerted military drive to overthrow the U.S.-backed government here.

A mutiny by elements of the Salvadoran Army to the west put in question the government's claim of monolithic opposition to the guerrillas. Martial law was imposed, and a nationwide curfew was declared for tonight from 7 p.m. to 5 a.m.

Despite the fighting, the guerrillas have not succeeded in taking any major city or garrison and there is little evidence of massive popular support for the insurrection that the leftists hope to ignite.

There were reports of scores of deaths among guerrillas, government soldiers and civilians.

[Associated Press cited reports from throughout the country indicating 100 had been killed in the 24 hours since the offensive was announced.]

President Jose Napoleon Duarte called a late-afternoon news conference to say, "the extreme leftist guerrillas did all they could to make this a final offensive and they have failed."

But several officials were expressing privately a serious concern about the mutiny in Santa Ana, the second-largest city, about 45 miles west of here.

A group of government soldiers rebelled there last night, coordinating with the guerrillas' announcement -- over a temporarily seized radio station -- of their "final offensive."

Reporters attempting to reach the scene today were turned back at gunpoint, but telephone interviews with residents in the city of 150,000 indicated heavy fighting went on there throughout the day and the guerrillas at least temporarily occupied much of the city. Forty persons were reported killed, but there was no confirmation of that.

Government radio announced that the leaders of that rebellion were Lt. Col. Albino Vladimir Cruz and Capt. Francisco Mena Sandoval. Both are considered loyal to left-leaning Col. Adolfo A. Majano, who was forced out of the ruling junta last month and has since gone into hiding.

Duarte and Col. Jaime A. Gutierrez, the vice president and commander of the armed forced, said an former officer recently ousted from the Army entered the Santa Ana barracks with a small group of guerrillas. They killed the colonel in charge, led about 80 troops out of the compound and set it afire, the chief executives said. They did not name the ex-officer.

By their account, the situation is now under control and all but 30 of the renegade soldiers have turned themselves in.

A split in the Army could be disastrous for the civilian-military government, which President-elect Ronald Reagan has said he plans to continue supporting.

Despite the appointment of Christian Democrat Duarte as president last month, the leadership remains essentially military and has grown increasingly conservative in the 15 months since it seized power in a bloodless coup and gained Washington's backing with promised reforms.

As many as 10,000 people died here in political violence last year, many at the hands of the military. But now, after months of waiting, the guerrillas' often-promised offensive appears to be receiving little active support from the people they have called on to revolt.

When guerrillas fanned out through some neighborhoods early this morning, residents watched passively as the young leftists, many with bandanas covering their faces, marched by.

Most of the action thus far has been between government troops and hardcore guerrillas, estimated at a strength of about 5,000, under the command of the Farabundo Marti National Liberation Front.

At times today the guerrillas appeared to go out of their way to be polite, even chivalrous, with the civilian population. In the middle of a fire fight in the neighborhood of Mexicanos, a young rebel stopped shooting for a moment to open a gate for a woman running to her house with her arms full of laundry.

But elsewhere guerrillas were seen systematically shooting supposed government informers. An American television reporter said that about 16 miles north of the city this morning he witnessed a group of rebels killing as many as 20 civilians in a panicky burst of gunfire before the Army arrived and wiped the guerrillas out.

Some observers believe such tactics by the rebels have undermined what support they might otherwise expect to receive from citizens who often complain of having suffered for years because of the government.

"The guerrillas have soiled their own nest," a U.S. diplomat said. "They've used excessive violence against the people and that is death for a guerrilla movement."

In some cases, as Duarte said, the guerrillas failed to achieve their apparent objectives. When they attacked the military airbase here at the outset last night, they did no major damage despite a prolonged shootout.

In other cases, such as their actions in the slum neighborhoods, they simply struck fast and quit the scene, apparently seeking to create maximum confusion with minimum losses.