Sandinista mobs, after three days of mounting violence, took control of Nicaragua's highways late yesterday, forcing cancellation today of a rally that was to have been an important symbol of the 20-month-old government's commitment to political pluralism.

The violence, which has left two dead and several injured, increased after the Sandinista leadership approved the rally Friday. The events left even usually well-informed government sources confused, speculating that the leadership's decision to permit the rally may have been undercut by more radical, second-echelon Sandinista leaders.

"It seems that it's a blow against the leadership," said one Sandinista source. "But I just don't know for sure."

The several observers felt that the nine-man ruling Sandinista party directorate, in deciding to permit the rally, had yielded to internal and international pressure to prove its often stated claim that it supports a multipart democracy.For months, the leadership had denied rally requests by opposition politician Alfonso Robelo, a non-Sandinista who had once been a member of the governing junta and who now heads the Nicaraguan Democratic Movement.

Although the party he leads is small and has never been tested in elections, Robelo and his movement have become the symbol here of the government's ability to tolerate peaceful opposition. Tension over Robelo's activities and his repeated public criticism of the Sandinistas had been growing for months and in recent weeks has been compounded by pressure on the Sandinistas by the Reagan administration.

The administration has threatened to cut off all U.S. economic aid here unless the Sandinistas stop alleged shipments of weapons through Nicaragua to leftist guerrillas in El Salvador. While the government here denies any involvement in the Salvadoran conflict, both the Sandinistas and the administration are aware that the issue of U.S. support for Nicaragua goes much deeper -- to the county's close relationship with Cuba and the insistence of powerful U.S. foreign-policy conservaties that the government is already too far to the left to merit assistance.

Washington reportedly will make a decision on the aid within the next several days, and informed observers here noted that it is likely to be influenced by last week's political violence, and the strident statements of some Sandinista leaders.

Sporadic harassment of the movement's supporters began last week when the Sandinista leadership indicated it would permit a rally in Nandaime, about 40 miles west of Managua.

Members of the Sandinista youth group reportedly ransacked the movement headquarters here, threated and attacked people distributing leaflets for the rally and stoned homes belonging to movement leaders. The leaders charged that Sandinista police made little effort to protect party property and that when police arrived at the destroyed headquarters in Managua they merely let the crowd drift away.

On Friday, Interior Minister Tomas Borge, apparently with the approval of the party directorate, formally approved the rally and announced that he would take steps to ensure that no violence occurred. But then Leticia Herrera, head of the Sandinista self-defense committees through which the government organizes on a local level, denounced the rally and urged her supporters to take to the streets.

Friday evening, a militiaman and a movement supporter were killed in a melee near Tipitapa, 15 miles east of Managua. There were also reports of injuries in streets fighting in other cities.

Managua Police Chief Enrique Schmidt, in a news conference at midday yesterday, dennounced movement "provocations" and produced two movement supporters arrested during the incident near Tipitapa. Later in the day, revolutionary commander Dora Maria Tellez, the main speaker at a service for the slain militiaman, said that neither the party nor the government could keep asking the people to be calm in the face of what she called increased reactionary provocations.

According to press reports, Tellez accused "reactionaries" here and in Honduras and Miami defaming Nicaragua in an attempt to influence Western financial institutions, whose loans have kept the faltering economy afloat, to withdraw their support.

By late yesterday mobs reportedly had blocked off all roads in most major cities and especially around Nandaime. News reports from several other cities said movement supporters' cars had been burned and some movement leaders apparently had been detained by police.

Robelo, who met throughout yesterday with party leaders, decided late last night to cancel the rally and sent a statement to be read on the movement-controlled radio station.

I had to do it," Robelo said in an interview at his home. "There would have been a massacre if we had gone ahead."

The radio station broadcast bulletins saying an "important at 10 p.m., but a crowd of about 300 took over the station, which went off the air less than a minute before the statement was to be read.

The station resumed broadcasting about 30 minutes later after Interior Minister Borge arrived with Army units to disperse the crowd. The announcer did not read the statement but instead interviewed Borge, who said the movement was to blame for "provoking the ire of the people" with its counterrevolutionary views.

Informed sources speculated that either members of the ruling party directorate secretly promoted the mobs in an attempt to discredit Borge or that middle-level officials, promoting a crackdown on dissent, acted without approval of the directorate.

After the mobs took over, these sources said, the directorate would have had the choice of admitting it was not in control of the country or jumping on the bandwagon.

In an interview last week, Sergio Ramirez, a Sandinista junta member, noted that there was significant opposition from the left to the leadership's attempts to strike a relatively moderate line. "It costs us a lot [politically] to keep the rich here," he said.

Oddly, the outbursts have come at a time when, many observers agree, the Sandinistas could easily have won a general election -- something they decided they would not hold until 1985. Although the Sandinistas have lot considerable support in the last 20 months, the general feeling here is that they could win around 60 or even 65 percent of the popular vote, despite widespread and growing disenchantment.

Robelo had estimated that the movement rally might draw up to 60,000 supporters. Other observers feel it probably could have drawn no more than a third that number, but emphasized that most of those attending might not be Robelo supporters but people disenchanted with the Sandinistas either because of mismanagement of the economy or for apparently attempting to impose what many here believe amounts to a Marxist dictatorship.