SANTA DOMINGO

In many Latin American countries, politics traditionally places second only to Catholicism as a national activity, and perhaps the sole ritual that provokes more public emotion than a funeral is an election.

With many of the Dominican Republic's Latin neighbors living these days under military governments, and its own fledging democracy briefly threatened just three months ago with an abortive military takeover, this Caribbean republic had added reason to celebrate the inauguration this week of a new president and a peaceful change of ruling party.

On inauguration day Wednesday, it appeared that only the most hard-core supporters of outgoing President Joaquin Balaguer, who was roundly beaten in elections last May by Antonio Guzman, stayed glumly inside. Thousands took to the streets in a frenzy of horn blowing and singing that lasted far into the night.

One longtime observer of the Caribbean judged the commotion as comparable in recent years only to the 1971 funeral of dictator Francois "Papa Doc" Duvalier in Haiti.

According to a small item in the newspaper Listin Diario, only two revellers were killed. Both it said, were shot by soldiers ostensibly attempting to disperse crowds in the country's interior.

THE INAUGURAL ceremony here in the capital was a classic example of the gloriously sweaty, cheerfully confusing and profoundly moving political event that characterizes traditional Caribbean and Latin democracy.

While rifle-toting soldiers surrounded the Congressional Palace and stood at every entrance, they seemed more interested in smiling and gawking at the crowd than in maintaining security. By the time the ceremony began, nearly half an hour late, the inaugural chamber was packed with nearly twice the number of people as there were seats. Dress ranged from formal to blue jeans.

Although Guzman later took two hours out of his inaugural day to lunch with U.S. Secretary of State Cyrus Vance, the ceremony clearly belonged to the Dominicans.

Vance listened to Guzman's 80-minute speech squashed in a seat against the wall in the far corner of hot room. His interpreter crouched atop a television monitor and security agents pressed to the wall by journalists, military officers, and other officials. Vance tucked his long legs under his chair, borrowed a piece of paper from a nearby colonel, and took crabbed notes as his forehead dripped.

Occasionally a stadium-like cry of "Viva Guzman" from the audience interrupted the ceremony, and cheers of the thousands standing outside in the 90-degree heat were heard through the open windows.

To the surprise of some of the foreign visitors, Panamanian Gen. Omar Torrijos, the only outside head of state at the inauguration, was given a seat on the crowded dias along with Guzman and Balaguer.

Attired in a dress-white military uniform, Torrijos entered the chamber to ringing applause. While the foreigners appeared at a loss to explain his popularity here, one Dominican said that Torrijos enjoys a certain status in Latin America because of his image - apparently gained in Panama Canal treaty negotiations - as someone who stands up to the United States.

Torrijos, who was greeted with cheers wherever he went in Santo Domingo, responded with a little gratuitous campaigning of his own. He papered the lobby of his hotel with leftover treaty posters sporting his picture and the legend, "We're with you, Omar."

Dominican pleasure with Torrijos' defiance of the United States could appear to contradict this country's strong desire for U.S. friendship and aid. But for this republic with long years of harsh lessons in the realities of power politics, it was but one of many ironies.

PERHAPS THE most biting irony on inauguration day came in Guzman's new office as he swore in new armed forces chiefs to replace those who led the unsuccessful fight against him last May.

All of the new commanders, who apparently had been rushed to the presidential palace without knowing why, were part of the military that fought against Guzman's party during the 1965 civil war. Yet, the surprised officers smilingly accepted their new commands and quickly went back to the barracks to oust their former chiefs.

During the swearing in, Guzman gave special thanks to Gen. Antonio Imbert Barrera, whose fast footwork and long string of military connections were privately credited with arranging the quick and so far painless military transfers.

Imbert's long history here typifies Dominican acceptance of political realities. He is the sole survivor of the group that assassinated Dominican dictator Rafeal Trujillo in 1961. Balaguer temporarily emerged as president at that time.

Shortly thereafter, Imbert was a leader of the military overthrow of Juan Bosch, the first elected post-Trujillo president and founder of the Dominican Revolutionary Party Guzman now heads.

That overthrow eventually led to the civil war, with Bosch's party on one side and Balaguer, most of the military, and Imbert on the other.

But at least for now, the new reality is Guzman and the Revolutionary Party. Today, Guzman needs the military needs the support of the people who voted for Guzman, and Imbert, like most Dominicans, is a realtist.