A small country gradually emerging from military repression and economic depression, Uruguay has been groping for the democratic balance of forces and economic formulas that once marked it as a haven of comfort, security and freedom in Latin America.

The road back is slow and rocky, obstructed by labor strife, economic stagnation and restlessness in some sectors of the armed forces that still are not fully convinced they did the right thing by turning over power to civilians 15 months ago.

But having scored a few modest successes in office, President Julio Maria Sanguinetti is traveling to the United States this week to promote his struggling country, seek American private investment and make the point that U.S. farm subsidies and trade barriers are hurting Uruguayan agricultural exports. He is to meet with President Reagan on Tuesday.

It is the first state visit to Washington by a Uruguayan leader in more than 30 years, and those on the U.S. side involved in planning it sound eager to play up the occasion, hoping to reinforce the Reagan administration's backing generally for Latin American democracies.

"The administration regards Uruguay as a prime example of a democracy that is working politically and economically," said Malcolm Wilkey, the U.S. ambassador in this antiquated capital located across the wide Plata River from Buenos Aires.

Sanguinetti, in an interview, listed his first year's achievements. He was seated in a conference room with a panoramic view of Montevideo -- a view meant for military leaders who, planning a new Defense Ministry, initiated construction of a tall concrete structure that today houses the president's offices instead.

He cited the "full functioning of political institutions" and a "fluid and positive dialogue" among political groups, which two months ago resulted in the signing of a limited multiparty economic accord. On the economy, Sanguinetti pointed to reduced inflation, a diminished budget deficit, increased real salaries and, for the first time in years, no decline in the gross domestic product.

Opposition party members question the lasting effect of this apparent economic turnaround, attributing it more to such international factors as lower interest rates and depressed oil prices than to the government's economic program. They say that while Sanguinetti has managed the crisis, he has failed to initiate a creative reactivation of the economy that would ensure long-term growth for the country of 3 million people, which formerly was able to finance an extensive social welfare system with beef and wool exports.

Determined as the political establishment here is to avoid a return to authoritarian rule, Uruguayans see three main problem areas that could upset the foundations of their fledgling democracy: labor protests, military crimes and U.S. trade competition.

Since Sanguinetti's inauguration in March last year, several public-sector work stoppages have disrupted business activity. The protests seem at times to have more to do with politics than economics. Among the demands pushed by the communist-controlled labor federation are a moratorium on foreign debt payments and other changes in government policy that would give the country a more socialist cast.

Sanguinetti has tolerated the demonstrations and strikes, appearing reluctant to use force against them so soon after the end of dictatorial rule, particularly in the absence of any comprehensive labor legislation defining worker-management relations. He has counted instead on the weight of irritated public opinion to restrain the protests.

Sensing that many Uruguayans were getting fed up, the president toughened his stand two weeks ago and declared that strikes in certain "essential services" -- the social security administration, the ports, the hospitals -- would be met with sanctions. Labor leaders responded by scheduling a general strike Tuesday as Sanguinetti is seeing Reagan.

Perhaps more menacing for Sanguinetti are the unresolved murder and torture cases linked to the armed forces during their 12-year rule.

Under terms negotiated for the return of democracy, the military was left with the understanding that there would be no trials of armed forces personnel for crimes committed while they were in power. At the same time, military officials declined -- out of pride and principle -- to be included in an amnesty that authorized the release of jailed Tupamaro guerrillas and other political prisoners.

So victims of the repression, and relatives of the 170 persons kidnaped and presumably killed by the military, have continued to press for justice. Opposition politicians see the issue as convenient to use against Sanguinetti.

"Unfortunately, the subject of the armed forces has become politicized," said the Uruguayan leader, whose own political rights were proscribed between 1976 and 1981. "Some political sectors have developed a very aggressive attitude on the issue. This is dangerous because it creates a certain perturbation. It's not good for any country to keep alive a confrontation between the armed forces and any part of society."

In neighboring Argentina, junta members were disgraced by their loss in the Falklands war against Britain. They surrendered power and subsequently stood trial for crimes committed earlier in combating left-wing dissidents.

The Uruguayan military negotiated their exit from a position of strength. But at the height of the repression here in the mid-1970s, Uruguay had the highest number of political prisoners per capita in the world, according to Amnesty International.

Sanguinetti, known for his deftness at steering compromise courses, is giving serious thought to proposing an amnesty for the armed forces, which are said to be more inclined now to accept one. But the left-leaning Broad Front coalition, which has seats in Congress, insists that some military officers be brought to justice for the killings and tortures that have come to light.

The National Party, which together with Sanguinetti's Colorado Party traditionally has dominated Uruguayan politics, contends that civil courts should at least be free to investigate claims against the armed forces -- a point currently contested by the military in a suit before the Supreme Court.

"It is not good to reconstruct democracy on the basis of vengeance," said Wilson Ferreira Aldunate, the National Party leader who spent 11 years in exile and, on his return in 1984, was imprisoned for several months and blocked from running against Sanguinetti. "But it would be very bad if nobody is held accountable for anything."

While relations with the United States are generally good, complaints center on U.S. subsidies of beef, rice and other farm products, which are said to be undercutting Uruguayan sales to foreign markets. American trade practices, say officials, endanger not just Uruguay but the continued stability of Latin America's debt-ridden democracies.