Anger and frustration with Nicaragua have boiled over in this normally placid country following a recent border incident in which two members of the Costa Rican Civil Guard were killed and nine others were wounded.

President Luis Alberto Monge went on nationwide television last Monday to accuse Nicaragua's Popular Sandinista Army of killing the two men by firing mortars and other weapons at a Civil Guard patrol both from within Costa Rican territory and from across a river that marks part of the boundary between the two countries.

Foreign Minister Carlos Gutierrez said after the incident May 31 that "Nicaragua does not have the will" to develop a peaceful relationship with Costa Rica.

The incident led Costa Rica, technically neutral in Central America's conflicts, to downgrade diplomatic relations with leftist-ruled Nicaragua and to make an unusually strong appeal to the Organization of American States to investigate the events.

It also asked the United States to speed up delivery of the second half of a major shipment of arms giving the Civil Guard the same basic infantry weapons as a modern army. Costa Rica disbanded its army in 1949 and has attributed a relative political stability since then to that fact.

The approximately 4,000-strong Civil Guard officially is considered a paramilitary force to distinguish it from an army. Earlier this year, the United States delivered the first half of a shipment of 4,000 M16 automatic rifles, 75 machine guns, 200 grenade launchers and a dozen mortars to modernize the Civil Guard's armament, the U.S. Embassy here said. Previously the guard had aging M1 rifles, and its mortars and grenade launchers were so old that they generally were unusable, the embassy said.

The second half of the shipment, which was supposed to arrive during the next few months, now is due in the next couple of weeks following Costa Rica's request for a speed-up.

In another sign of military modernization here, it was announced last month that about 25 Green Berets will train 1,000 Civil Guardsmen in counterinsurgency techniques in an escalation of U.S. military training.

Costa Rica's reaction highlighted a gradual worsening of relations with its leftist neighbor during the past two or three years, according to Costa Rican officials and businessmen and U.S. Embassy officials here.

Most of the troubles have sprung directly from combat incidents along the border, where Nicaraguan rebels have a string of base camps in jungle just across the San Juan River that marks part of the frontier.

The rising discontent with Nicaragua was viewed here as a plus for the Reagan administration, which has encouraged Nicaragua's Central American neighbors to unite in confronting the Sandinistas. Leaders of Costa Rica have said privately that the United States has pressed them to adopt a strong anti-Sandinista policy.

Outrage against Nicaragua has swelled here in the past over border incidents only to fade quickly. Costa Rican and U.S. officials acknowledged that it was difficult to predict whether the current sentiments would last long. But the trend in relations certainly has been downward.

"There has been a shift in Costa Rican attitudes. They're more concerned about Nicaragua now than in 1982," a senior U.S. official said.

The incident May 31 at the hamlet of Las Crucitas has had a particularly big impact because of the killing of the two guardsmen, who were the first to die in such an incident since November 1978. At that time the killers were members of the National Guard of Nicaragua's then dictator, Anastasio Somoza, and the Sandinistas were the guerrillas battling the government along the border.

The 1978 incident, which led Costa Rica to break relations with Somoza's government, was recalled repeatedly here during the last week.

"Having benefited from the international outrage that followed Somoza's brutal aggression against Costa Rica in 1978, the Sandinistas of all people should comprehend the consequences of attacking a Costa Rican Civil Guard patrol," The Tico Times, an English-language weekly, said in an editorial.

The anger also was fueled when Costa Rican authorities reported that Sandinista forces fired on Civil Guard units sent June 2-3 to recover the bodies. The second body was not recovered until Thursday.

Costa Rica also charged that Nicaraguan aircraft repeatedly have been violating Costa Rican airspace in attacking guerrilla camps and that Sandinista troops regularly were crossing the border to attack rebel bases from the rear.

"The violation of our territory is happening 24 hours a day," Col. Oscar Vidal, the Civil Guard's top commander, said.

Public response has been strong, as newspapers have been filled with paid advertisements criticizing the government for weakness. About 200 taxi drivers burned the red and black Sandinista flag in front of the Nicaraguan Embassy on Thursday.

"The problem is that they cross into Costa Rican territory. We have put up with too many abuses already," Luis Vega, a taxi driver who participated in the demonstration, said.

Monge announced last Monday that Costa Rica would not send a new ambassador to Managua to replace the one who recently was transferred. On Friday, Foreign Minister Gutierrez went before the OAS in Washington to seek an investigation, and it was decided that OAS Secretary General Joao Baena Soares would lead a commission to visit Costa Rica and prepare a report.

The Costa Ricans sought the secretary general's participation in part to ensure that the investigation would be a serious one. Past Costa Rican efforts to obtain satisfaction after border incidents through the OAS or the four-nation Contadora mediating group have foundered.

The Nicaraguan government, which currently is staging a major offensive against rebel groups based along its borders with both Costa Rica and Honduras, has said that guerrillas fired on the Costa Rican patrol to create an incident. Nicaraguan officials noted that such an incident was timely because it might have an impact on the current U.S. congressional debate over whether to provide funds to the Nicaraguan rebels.

"Nicaragua has denounced the various maneuvers carried out by the U.S. CIA with the object of provoking fictitious incidents between Costa Rica and Nicaragua to be used to worsen relations between both countries and justify the U.S. government's warlike and interventionist policy against Nicaragua," a Sandinista communique said.

The rebel Revolutionary Democratic Alliance, which is based along the Costa Rican border and is led by former Sandinista hero Eden Pastora, denied that its forces had fired on the guardsmen.