President Reagan congratulated El Salvador's government today for apprehending three terrorists suspected of killing four U.S. Marines, and a White House official said that the action demonstrates the need for additional antiterrorist assistance to U.S. allies in Central America.

Salvadoran President Jose Napoleon Duarte announced Tuesday that his government had arrested three guerrillas who are believed to have participated in the June 19 massacre of 13 people, including four off-duty Marines, at a sidewalk cafe in San Salvador.

"We congratulate President Duarte and his government for the speed and efficiency of their work against the terrorists responsible for those brutal murders," White House spokesman Larry Speakes said.

Reagan sent a letter to Duarte today in which he said he would use U.S.-El Salvadoran cooperation that led to the arrests as an example when he consults with Congress on a request for additional antiterrorist aid, a senior White House official said. The official said that an aid request totaling $53 million is pending in the administration and is scheduled to be presented to Congress this fall.

The administration is expected to ask Congress for a supplemental appropriation to provide additional military support and police training funds to El Salvador, Honduras, Costa Rica, Guatemala, and Panama. The purpose, officials said, would be to improve the "counterterrorism capabilities" of those governments.

Speakes said he "couldn't make a judgment" on whether the suspects would have been arrested without U.S. help. But he said at today's White House briefing that the United States had provided financial assistance and training for the special investigations commission that assisted in the inquiry before the arrests.

The commission, which is subordinate to the Salvadoran attorney general's office, received FBI training in evidence-gathering and forensics.

Speakes said later that the arrests "send a message" to would-be terrorists that such cooperation brings results. At the time of the killings, which took place during the crisis of the hijacking of a TWA airliner to Beirut and the kidnaping of Americans aboard, Reagan issued a strongly worded statement warning that the killers of the Marines would be punished.

But officials said at the time that the president also rejected an appeal from senior advisers Patrick J. Buchanan and Edward J. Rollins for a generalized military retaliation on guerrilla strongholds that might be used to kill innocent people.

The arrests announced in El Salvador this week were welcomed by the president and national security affairs adviser Robert C. McFarlane because they demonstrated that terrorists can be brought to account without widespread reprisals, officials said.

Speakes said that one of the guerrillas had confessed and that it had been independently verified by the U.S. embassy staff in El Salvador, which believes his statement to be true.

U.S. acceptance of the statement contrasts with the more cautious White House reaction after Secretary of Defense Caspar W. Weinberger said July 31 that Salvadoran troops had killed and captured a number of persons responsible for the killings.

Salvadoran authorities said Tuesday that the guerrillas captured this week were not those referred to by Weinberger.

The shootings were carried out in a district known as the Zona Rosa (Pink Zone), which the Marines had often frequented.

Immediately after the massacre a rebel group, the Central American Revolutionary Workers' Party, claimed responsibility for the attack. Besides the four Marines, victims included two American businessmen, a Chilean, a Guatemalan and five Salvadoran civilians. On the basis of the guerrilla's confession, investigators believe that one of the slain Salvadorans may have been an accomplice of the guerrillas, sources said.

The United States offered $100,000 for information leading to apprehension of the killers. Speakes said he did not expect this reward to be claimed because the arrests were made by the Salvadoran government.