Nicaragua's top counterrevolutionaries ended a marathon meeting in Miami yesterday, altering their alliance to give more power to relative moderates led by Arturo Cruz, according to Nicaraguan and U.S. sources. No major leadership shifts occurred.

The closed-door power contest, which dragged on nearly three weeks, was the most intensive internal review by the contras since they began as a 500-rebel cell, recruited by the CIA, more than four years ago.

The summit of the contras, as the Nicaraguan rebels are known, included economist Cruz, Adolfo Calero, head of the 10,000-guerrilla Nicaraguan Democratic Force (FDN), and Alfonso Robelo, a Costa Rica-based businessman. They are the senior directors of the Unified Nicaraguan Opposition, the contras' broadest umbrella group.

Calero retained his position. He has been widely attacked in recent months by opponents within the movement who charge that he is corrupt. He is also under pressure from Reagan administration officials who contend he does not appeal to a broad range of Nicaraguans opposing the leftist Sandinista government.

Sources familiar with the discussions said removal of any of the highest ranking leaders was never seriously considered. "This was a struggle over power, not personalities," one observer said.

But after protracted wrangling, the leaders adopted new rules proposed by Cruz for naming and dismissing guerrilla field commanders, making decisions among themselves and subordinating all contra organizations to their rule, the sources said.

They also agreed to develop rapidly a guerrilla front independent of Calero's FDN in southern Nicaragua, where contra rebels have thus far suffered a virtual rout. "Cruz's and Robelo's army" was how one observer decribed it.

The new moves are seen as strengthening the hand of Cruz, who enjoys the confidence of a wider range of Washington legislators than the other two. Contra leaders and administration officials hope they will improve the prospects for congressional approval of a $100 million package of military and nonlethal aid expected to come up again for debate on June 16.

It remains unclear how the hard-fought but limited changes will affect the course of the fighting inside Nicaragua, where Sandinista troops have held a clear upper hand for most of the past year.

In Miami, according to one FDN official, many anti-Sandinista Nicaraguan exiles were demoralized by the much publicized differences among the contra leaders. Some rebel fighters in Nicaragua and at base camps in Honduras were "depressed and very alarmed" by reports of the disputes in Miami, an FDN member reported.

"We aren't even close to getting back to power in Nicaragua," complained one FDN official. "We're arguing about political power that doesn't exist yet."

Contras and U.S. officials said Calero voluntarily ceded some of his influence to ward off a move by administration officials to force him to do so. "We said, 'You guys work it out or we'll have to work it out for you,' " one U.S. official said here.

The sources said the three contras agreed to Cruz's ultimatum that they take most decisions by "majority rule" -- so that Cruz and Robelo can outvote Calero.

In one important exception, the leaders agreed that naming of guerrilla field commanders must be done by what they call "consensus," meaning all three must agree. But after hours of testy debate, the contras reportedly decided to leave the dismissal of military commanders to a "majority" vote.

In practice that means, the sources said, that Cruz and Robelo could, for example, vote to dump FDN military chief Enrique Bermudez, once a colonel in the former Nicaraguan National Guard -- although they have not suggested they intend to do so.

Cruz agreed early on that the day-to-day operations and tactics of the rebels on the battlefield would not be subject to vote or approval by the top three leaders in exile, the sources said.

Calero is said to have pressed for other exceptions to the "majority" procedure, so that decisions on budgets, on accepting new groups into the alliance and adding high ranking directors must now be made by all three leaders.

The contras agreed to demand that all organizations in the Unified Nicaraguan Opposition, which includes Miskito Indian rebels and a small guerrilla army under Robelo, declare in writing that they will respect the decisions made at the top.

Carlos Ulvert, a Harvard-trained businessman who has been close to Cruz, was chosen over angry objections from Calero to be a kind of ambassador-at-large in foreign relations for the umbrella group.

The contras also appointed a liaison between them and guerrilla field commanders, part of whose job will be to monitor the enforcement of human rights codes. The man, Luis Rivas, formerly a fighter under the mercurial leader, Eden Pastora, was accepted by all sides in the dispute.

The contras are to appoint a financial auditor to oversee their finances, in response to recent charges that they skimmed off State Department funds for their own enrichment.

Contra supporters close to Cruz were describing the outcome as a triumph for the sometimes diffident former banker. "I may be only a pebble," Cruz crowed to one of his advisers, "but I can't be moved."