After three days of general confusion and fear of a military coup, the powers that be in the Dominican Republic apparently have decided to accept - however gracelessly a change in government.

Barring ast-ditch military resistance or unlikely surprises in what is now a near-complete tally of results from Tuesday's election, Antonio Guzman, 67, a businessman cattle rancher, will replace President Joaquin Balaguer, 70, on Inauguration Day Aug. 16.

Balaguer and his supporters, who started the week confident of a fourth victory for the aging, conservative president, seem now to how reconciled themselves to his defeat.

The armed forces, which apparently panicked and stopped the vote tabulation when initial returns showed Guzman winning by a landslide, have gone back to their barracks.

Whether they will stay there until the Electoral Commission makes the official tallies final in the next few days remains the key question. Dominicans have learned to be wary of the country's armed forces.

Sifting through the chaos, which began early Wednesday when troops occupied and shut down vote tabulation centers here, the following sequence of events emerges.

Throughout Wednesday, soldiers guarded locked offices of both the Central Electroal Commission, where precinct returns cabled from outside the city were tabulated, and the Santo Domingo District Commission, a few miles away, where votes from the capital were handled.

While United States and other countries fired off angry telegrams to Balaguer, demanding to know what was going on, and rifle-toting troops roamed streets emptied of frightened Dominicans, Balaguer and military leaders huddled behind closed doors, reportedly arguing over what to do next.

The only official statement released, which described the situation as "normal," was patently absurd to all observers.

Despite strong evidence to the contrary, the statement, issued by the military, denied a coup was in progress.

On Wednesday evening, democratic forces in the government appeared to bend to international pressure, and perhaps their own consciences, and it was officially announced that tabulation would resume.

While the tabulation centers reopened Thursday morning, their work was repeatedly interrupted when soldiers, still stationed outside, entered the buildings and cleared them at gunpoint. The seemingly confused troops backed off when confronted by angry electoral officials who under Dominican law are the country's supreme authority during election time.

These incidents were coupled with reports that soldiers were threatening electoral officials in outlying cities in an effort to make them falsify vote counts in Balaguer's favor.

The exercise appeared abusrdly futile, since the vast majority of the nation's precincts had counted their ballots immmediately after poll-closing Tuesday night and given certified copies of the results to poll watchers from each party before cabling the figures to the central Santo Domingo offices for final tabulation.

In other words, the final result of the election had already been determined, and was on its way to the computers, before the military intervention began.

Officials from Guzman's Dominican Revolutionay Party said their certified precinct copies showed him with a 2 to 1 win over Balaguer, a claim that some central electoral officials privately confirmed.

When Balaguer's Reformist Party unexpectedly claimed Thursday afternoon that totals from its copies showed a 180,000-vote plurality for Balaguer, many Dominicans feared the government had scrapped its plans for a coup and now planned to steal the electrion outright.

It was not until late Thursday night, two days after the trouble began, that Balaguer suddenly went on nationwide television to promise he would respect the election results. In an emotional speech that contained little in the way of explanation for events since the vote, Balaguer blamed everyone - the opposition, his own party, the electoral commission international interference and rumormongers - for what had happened.

Galo Plaza, a former president of Ecuador who was here last week heading a three-man election observer team sent by the Organization of American States, was the only outsider known to have seen Balaguer during his period of decision.

"I told him," Plaza said later, "that he was a man with a brilliant political career, who had saved his country from chaos and been a constructive president. Accepting the results of the election would be a final feather in his cap - it would assure his place in history.

"But I warned him he would be considered responsible for this shady ending, and asked if he wanted to commit political and historical suicide."

Whatever his reasons, Balaguer's speech was interpreted to mean he had given up and troops were withdrawn the following morning.

Looking back on the past week, political observers here now say what happened was predictable from the beginning.

For 12 years, since he was elected in 1966 to head the new Dominican democracy after a bloody civil war, Balaguer has ruled without serious challenge.

In 1970 and 1974, Baleguer ran virtually uncontested after the opposition withdrew, claiming the contests were rigged.

As this year's election approached, however, the opposition Dominican Revolutionary Party, was ready. Its well-organized cadres tapped a growing popular weariness with the long Balaguer administration and resentment of widespread corruption that enriched the president's friends and family along with military chieftians.

The Dominican Revolutionary Party, which allies itself with international socialist parties in countries such as Sweden and Spain and Portugal, hammered away, as it has for years, charging that Balaguer was an unreformed "Trujillist" - heir to the 30-year dictator, Rafael Trujillo, under whom Balaguer served as puppet president at the time of Trujillo's 1961 assassination.

The accusations are somewhat exaggerated, and Balageur deserves credit for keeping this volatile country together for so many years. But the criticism, and a national hope that, for the first time in Dominican history, a change of government could occur without violence, insured a massive voter turnout.