The gunmen who killed 13 persons at a row of sidewalk restaurants last night deliberately sought out the four U.S. marines who were among the victims, witnesses said today.

The Salvadoran and U.S. governments said they believed the killers were members or allies of the left-wing Farabundo Marti National Liberation Front, whose guerrillas have been battling the government for more than five years.

No group had claimed responsibility for the attack, in which two American civilians and seven Latin Americans also died, by this evening. But the Farabundo Marti front's Radio Venceremos welcomed the attack in its evening broadcast and warned that other U.S. military personnel might be targets of future attacks.

"Americans have begun to die," the clandestine radio, based in northeastern Morazan province, said. The broadcast did not discuss who had carried out the attack.

The attack, which was the first in two years in which U.S. military men were killed here, came at a time when the leftist guerrillas have said that they are stepping up urban warfare. The guerrillas consistently have criticized U.S. military and economic support for the government here, saying they would have won the war years ago except for Washington's backing of the Salvadoran armed forces.

The attack at the row of outdoor cafes at 8:35 p.m., the height of the evening rush, was widely repudiated.

"It is to be condemned from every point of view," Roman Catholic Archbishop Arturo Rivera y Damas said.

The four U.S. marines, who were guards at the U.S. Embassy, were off duty, unarmed and in civilian clothes, the embassy said. The two other U.S. citizens killed were employes of Wang Laboratories computer company who were visiting El Salvador. The other dead, all civilians, were five Salvadorans, a Chilean and a Guatemalan, the embassy said.

The Pentagon in Washington identified the four dead marines as Sgt. Thomas T. Handwork, 24, of Boardman, Ohio; Cpl. Gregory H. Webber, 22, of Cincinnati; Sgt. Bobby J. Dickson, 27, of Tuscaloosa, Ala., and Cpl. Patrick R. Kwiatkowski, 20, Wausau, Wis.

Wang said its two employes were George Viney, 48, of Miami, Fla., and Robert Alvidrez, of Lexington, Mass.

Most of those killed appeared to have been victims of indiscriminate firing. A spokesman for the U.S. Embassy said it was not certain that the marines had been the main target, although he noted that the killers' truck had stopped right in front of their table. Salvadoran Deputy Defense Minister Reynaldo Lopez Nuila said he believed the marines were the target.

The two witnesses, Manuel Argueta and Mario Orellana, said the gunmen fired their submachine guns and automatic rifles first at the table where the marines were seated and afterward sprayed bullets indiscriminately. Both witnesses were wounded in the attack and were interviewed in their beds at the Policlinica hospital.

Argueta, a restaurant security guard, said an unidentified young man had approached the marines shortly after they sat down, chatted with them briefly, observed them for a few minutes from a distance, and then bicycled away. Ten minutes later, Argueta said, the killers leaped out of a pickup truck directly in front of the marines' table.

"I already had thought that he the cyclist was spying," Argueta said.

Both Argueta and Orellana said the gunmen, dressed mostly in military fatigues, had walked among the overturned tables and cringing bodies at the end of the 10-minute attack and singled out people to shoot again. Orellana, a 22-year-old architecture student and office worker in a construction company, said he thought that he was chosen to be shot because he is light-skinned and the killers mistook him for an American.

"I was lying with four or five friends in a row, but I was the only one picked," he said. A thin, young gunman "looked at me without expression and shot a burst at me," he said.

Argueta, 23, said he believes he was shot twice in the legs because a gunman saw his pistol stuck in his belt as he lay face down on the floor. He also said he heard one of the attackers' leaders shout to another member of the gang, "Give it to him again; he's not dead." The order was followed by the sound of a machine-gun burst from near the marines' table, Argueta said.

Argueta said one of the six marines escaped death because he had left the table and entered the Flashback nightclub a few minutes before the attack, while another apparently managed to run away.

Six persons, none of them American, were seriously wounded in the attack, the Salvadoran armed forces said. Two of the wounded were released from the hospital after treatment last night.

The leftist guerrillas were considered probably responsible primarily because the marines were killed and because of the Farabundo Marti front's proclaimed desire to escalate its war in the capital. El Salvador's right-wing vigilante groups have killed thousands of persons during the civil war, but the number of killings of suspected leftist sympathizers has declined sharply.

Left-wing killings, mostly of military personnel, have picked up this year in San Salvador as the guerrillas apparently have sought to open a new front in response to the Army's improved performance in the countryside.

"This criminal act . . . confirms the desperation that these groups of killers currently feel because of the military defeat that they are suffering and that they cannot hide," an armed forces communique said.

The embassy spokesman said: "We assume that the perpetrators were members of, or associated with the FMLN," the Spanish initials for the Farabundo Marti front. "It is known from captured documents that the FMLN was moving into the capital," he added.

Interest centered in particular on the Clara Elizabeth Ramirez Front, a hard-line leftist group that formally broke away from the FMLN in December 1983 but whose actions have been praised by the FMLN on occasion.

In the past, however, anonymous callers claiming to represent the Ramirez front have telephoned radio stations to announce that the front had staged an action. No such phone call was reported today.

The People's Revolutionary Army, the most militaristic group in the FMLN, also has stepped up urban killings in recent months. But that group controls the guerrillas' Radio Venceremos, which thus normally is quick to claim any attacks by the rebel organization. The radio's coverage of last night's attack, welcoming the action but not claiming it, was typical of its coverage of past attacks staged by the Ramirez front.

Jorge Villacorta, the spokesman in Costa Rica for the civilian organization allied with the FMLN, said that he had consulted with the leftists' offices in Mexico City and that no information was available. "We learned of the attack from the press," Villacorta said this afternoon.

Only one U.S. military man had been assassinated previously in El Salvador, Navy Lt. Cmdr. Albert Schaufelberger III, who was slain by the Ramirez front in May 1983.

The marines, who reportedly visited the restaurant frequently, apparently violated U.S. Embassy rules. The embassy spokesman said that "we're all advised . . . not to frequent the same place on a regular basis."