El Salvador's Archbishop Arturo Rivera y Damas today condemned the "excessive barbarity" of last week's left-wing guerrilla attack that left four U.S. marines and nine civilians dead, but he also urged President Reagan not to use the attack to justify increasing military aid to the government here.

In a fresh sign that attacks against civilians were being accelerated, the armed forces and a witness reported that a mine exploded in the path of a six-vehicle caravan carrying Agriculture Minister Carlos Aquilino Duarte on a road about 10 miles north of the capital yesterday morning.

Nobody in the group was injured, although the remote-controlled explosive damaged the minister's armored civilian vehicle, an armed forces spokesman said. Attackers also fired a rocket-propelled grenade at the caravan, he said.

The government blamed leftist extremists for the assault, but no group was reported to have claimed responsibility. The agriculture minister is a distant relative of President Jose Napoleon Duarte.

Archbishop Rivera made a point of criticizing violence by the armed forces as well as by the guerrillas in his weekly homily at this capital's austere, concrete cathedral. He also said that the nightlife district, where the attack took place, harbored "places of drug consumption and centers of sexual abandon," saying that the zone's "ostentation" was a "scandal" when contrasted with most Salvadorans' living conditions.

Rivera's comments reflected the generally liberal orientation of many clerics in El Salvador. The Sunday morning mass here serves as a social and political forum.

Rivera specifically mentioned the United States in opposing retaliatory measures that could lead to more violence.

"Like a ghost at the bottom of many opinions glimmers the temptation of violent measures according to the law of a tooth for a tooth," the archbishop said. He added: "The reaction of President Reagan to give greater military support for the antiterrorist struggle in El Salvador can be dangerous."

Rivera spoke four days after the killings of the four off-duty, unarmed marines, and of civilians of U.S., Salvadoran, Guatemalan and Chilean nationalities at a row of sidewalk cafes in a well-to-do neighborhood.

An urban commando unit of El Salvador's Marxist-led guerrilla alliance, the Farabundo Marti National Liberation Front, claimed responsibility for attacking the marines and otherwise unidentified "agents" of U.S. and other nationalities.

"All [observers] agree that this was a terrorist act, and moreover emphasize that the guerillas never before had carried out an act with such excessive barbarity," the archbishop said.

Rivera equated the restaurant attack with "bombardments, destruction of crops, burnings of farms, forced exoduses" that he said reportedly were caused by the army during its current offensive in the major rebel stronghold of northeastern Morazan province.