Despite the violet bougainvillea vines that pour over every fence and wall, the brightly colored birds and even the greasy fried plantains and green mangoes on sale at corner stands, Costa Rica insists it is not a tropical country, but a Western democracy with a European-style society.

Although other Central Americans call Costa Ricans snooty, the ticos, as they are nicknamed in the region, have good reason for pride in their atypical social progress and three decades of democratic stability. In recent months, however, they also had reason to worry that their peaceful society may be washed away by turmoil in the area and a deepening, homegrown economic crisis.

Since the Nicaraguan civil war two years ago -- and Costa Rica's strong support for Sandinista guerrillas fighting the Somoza government -- cost this country a heavy price, President Rodrigo Carazo's Unity Party government and the traditionally stronger National Liberation Party fear violence in nearby El Salvador will mean trouble here.

In particular, they are nervous about the prospect that increasing U.S. military involvement in El Salvador and the involvement of rightist military governments in Guatemala and Honduras, will force Costa Rica to take a stand it would rather avoid.

"This is the most anticommunist nation in the world, believe me," said a government official. "But if Reagan got Guatemala or Honduras to invade El Salvador, we would have to denounce that in every forum. Doesn't Reagan know that the Guatemalan Army is the enemy of democracy -- any democracy, our democracy? If that Army went into El Salvador, we would be next in line."

Carazo's party and the opposition back suggestions for a negotiated settlement in El Salvador.

Both acknowledge the direct repercussions of civil strife in Central America on the Costa Rican way of life. The influx of refugees from Nicaragua and El Salvador, the crisis in the Central American Common Market, through which Costa Rica conducts much of its trade, the growth of local leftist union militancy and rightist armed groups are all seen as direct consequences of the region's eruptions.

The most recent sign of this increased unrest was the bombing last week of a car carrying U.S. Marines, apparently by a leftist guerrilla group.

For Carazo's government, these repercussions have been devastating: A 20 percent inflation rate, a slump in the national growth rate to barely 1 percent, and a debt service ratio of nearly 25 percent of the gross national product have turned the Costa Ricans bitterly against their government. It appears likely they will vote the National Liberation Party back into power for the seventh time in 34 years in elections next February.

From Carazo's point of view, there is little to be done. His administration is negotiating a three-year, $300 million loan with the International Monetary Fund. The loan package carries the usual IMF tight monetary and social restrictions, leaving the government little room to follow its own program. The opposition, known here as Liberation, insists that the economic chaos is the inheritance of Carazo's party's years of spendthrift administration and reckless living.

The opposition delights in horror stories of Carazo mismanagement.

"We are in debt, granted," says one of the opposition. "But we left the government in 1978 with $400 million in foreign reserves. Where is that money now? Gone, every penny. The government is bankrupt."

For Liberation's presidential candidate, Luis Alberto Monge, Carazo's unpopularity is sweet revenge indeed. Monge, who worked his way from peasant background up the party structure, ran against Carazo in 1978. The coalition backing Carazo focused its campaign attacks on Monge's reputed womanizing and generally festive living habits. In this middle class country, such accusations have great effect, and Monge lost.

But the tables have tipped. Charges of corruption in the Carazo administration have been rumored since last year. Beginning in January, they developed into formal accusations by the Office of Judicial Investigations, the local equivalent of the FBI.

Carazo's first security minister, Juan Jose Echeverria, resigned under allegations that he was heavily involved in the flourishing Costa Rican black market in arms. Now his replacement, Carlos Arguedas, has resigned and will probably face charges that his ministry sold refugee-status visas to perhaps thousands of Cubans who entered the country illegally.

His campaign sails taut with the winds of discontent over Carazo, Monge has been breezing through crowded public meetings on a platform of criticism of corruption, proposals for an overhaul of the budget, rejection of the IMF terms, promises of more jobs and better housing and defense of motherhood.

The specifics are the work of the National Liberation Party's ideologues, the generalities are Monge's standard campaign speech. At a recent public meeting in a small suburb 10 miles out of San Jose, the candidate arrived followed by an entourage of honking cars and buses. The party's green and white banners flapped noisily in the growing wind. A loudspeaker blared the tropical beat of the party campaign song from the yard of a small clapboard house where the meeting was to be held.

A few hundred spectators gathered in the dark. It was not the typical passionate, raucous Central American demonstration.

As Monge climbed on a wooden bench to speak, the people in the crowd spoke bitterly against Carazo.

"A liar, a liar. . . That man has deceived every one of us with his promises," said a teacher. Another woman, who runs a small grocery, explained her vote for next year: "Everything good that happened in this country is the work of Liberation. Look at us. We're so different from the rest of Central America. We have schools and hospitals and highways. Maybe they spent a little too much in the past, but nothing like Carazo. And what did he give us in exchange?"