Opposition candidate Antonio Guzman, a moderate leftist, has won the presidency of the Dominican Republic.

The final count yesterday of all but two of the country's 84 electoral districts gave Guzman, 67, a 150,000-vote victory over three-term President Joaquin Balaguer. Officials of the government party, indicated, however, that they had not given up on attempts to have the entire election annulled.

Under Dominican law, the results do not become official until June 15. Concerned U.S. officials, who have played a pivotal role in the unfolding Dominican political crisis, have said they do not believe the tension that began on election day, May 16, will subside until the inauguration of a new president next August.

Guzman's victory came 11 days after the Caribbean island nation was thrown into turmoil when the pro-Balaguer military forcibly stopped vote counting hours after the polls closed in a short-lived attempt to keep the losing conservative government in power.

The military withdrew after two days of intense domestic and international pressure on the government, including thinly veiled U.S. threats of aid withdrawal and direct appeals by President Carter and other world leaders for respect of the electoral process.

While counting resumed last week, it was slowed by late-arriving returns from the countryside, where Guzman's Dominican Revolutionary Party charged the armed forces were harassing electoral officials.

The government's Reformist Party has subsequently questioned the legitimacy of the vote. In a speech shortly after the military withdrawal, Balaguer said there had been "grave irregularities" in electoral procedure.

The Balaguer government made no concession or comment on yesterday's results. But party official Wilfredo Mejia said the Reformists are in the process of collecting identity cards of hundreds of thousands of Balaguer supporters who they allege were intentionally omitted from registration lists and subsequently turned away from the polls.

"It's the first time the government party has tried to blame the opposition" for electoral fraud, Emilio L. Fernandex, international relations secretary for the opposition party said yesterday in a telephone interview from Santo Domingo.

Officials at the Central Electoral Commission, which compiled the registration lists, are all government appointees. In the past two Dominican elections, in 1970 and 1974, the opposition Revolutionary Party charged the government with fraud and harassment and withdrew from the races, leaving Balaguer virtually unopposed.

There is a little dispute of the fact that a large number of voters, perhaps as many as 25 percent, were refused ballots bacause their names were not on the computer lists. One likely reason the omission is the flood of new registrants for this year's election following low turnouts in the two previous uncontested races.

Opposition officials maintained that an equal number of their own supporters were left off the list, and said Dominican electoral law does not allow for a new vote. They viewed the government party charges as desperation strategy.

Guzman's vice presidential running mate, Jacobo Majluta, said yesterday that he and Guzman are ready to meet with Balaguer to discuss the transfer of power.

Despite military fears that the Guzman administration would turn the country sharply to the left, after 12 politically and economically conservative years under Balaguer, Guzman has said he will continue with most aspects of Balaguer's foreign policy, and will not establish relations with Cuba and the Soviet Union.

Guzman has also pledged to respect existing Donimican contracts with foreign multinational companies, but has said that new contracts would require more Dominican participation.

While he promised to stop widespread corruption in the military that he said grew under Balaguer, Guzman has said he will not "sift through the dirt" of past crimes, and will respect the "institutionality" of the armed forces.