Miscalculations by U.N. Secretary General Kurt Waldheim and his top aides have played into the hands of Iranian militants opposing the liberation of the estimated 50 Americans held in the U.S. Embassy in Tehran.

A series of indiscretions traceable to the United Nations appears to have upset a carefully negotiated -- and purposefully vague -- tacit Iranian-American understanding on the nature of the five-man fact-finding mission now in Tehran, according to informed sources.

The demonstrable result, the sources noted, was Ayatollah Ruhollah Khomeini's declaration last Saturday that effectively ruled out the hostages' release before April.

Throughout the five days since the commission's arrival in Tehran, those Iranian authorities who want a rapid resolution to the four-month-old crisis have had to struggle with the militants holding the U.S. Embassy for agreement that the commission would be able to perform one of its most important tasks -- visiting the captive Americans.

That visit has become an acid test of the relative powers of new President Abol Hassan Bani-Sadr and the captors, who are maneuvering for Khomeini's crucial support. Waldheim's failure to nail down some agreement on this and other key points before the commission has endangered the best hope to date of ending the crisis between Tehran and Washington.

The source conceded that Khomeini consistently has shown the ability to initiate surprising twists and turns in revolutionary Iran. But they argue that it is that very record which should have dictated extraordinary prudence.

Perhaps the most serious U.N. error -- which some observers ascribe to Waldheim's desire to publicize the U.N. effort -- was in depriving Iran of appearing to win a great victory in the formation of the fact-finding commission.

President Abol Hassan Bani-Sadr, Foreign Minister Sadeh Ghotbzadeh and those Iranians who actively favor ending the hostage crisis needed to demonstrate their muscle against hard-line religious forces backing the hostages' fundamentalist student captors.

But instead of emerging as an Iranian victory grasped from a reluctant United States, the commission was presented at the United Nations as a Waldheim initiative that Iran finally accepted after Washington had given its approval.

Listed among the U.N. errors by sources familiar with the negotiations are claims that the commission had been formed when perusal of the record in Washington, Tehran and New York indicates Waldheim was still dickering to find the fifth and final member of the commission.

Similarly, Ghotbzadeh at the end of his European tour last week pleaded, according to the sources, for a delay of several days before the commission left for Tehran. He argued that he needed time to explain the commission plan to the Tehran authorities and persuade any last-minute doubters.

Instead, Waldheim dispatched the five commission members to Geneva Airport, where they waited on the tarmac for hours last week Wednesday before their departure was officially postponed.

As a result of these errors, Bani-Sadr felt constrained to raise the ante by accepting the commission, but referring to its role as that of a "tribunal to study" the U.S. role in Iran and deposed shah Mohammad Reza Pahlavi's "treachery, murder and corruption."

That far exceeded the commission's mandate to investigate Iran's grievances and allow for a solution to the crisis between the United States and Iran. The United States specifically ruled out anything smacking of a tribunal likely to condemn Washington's past policies.

Moreover, observers noted, Bani-Sadr's militancy also put him in direct conflict with Khomeini himself. If the newly elected president's terms were accepted by the United States, that would enhance his prestige -- and not the ayatollah's.

In the fluid politics of Iran, such an implicit challenge was enough to prompt Khomeini to issue his Saturday thunderbolt indicating no release for the Americans until April.

If nothing else it signaled that his month-old hospitalization had not diminished his political clout. At the same time, it inherently clipped the wings of both the students and Bani-Sadr and further postponed the hostages' release.

"The past year has shown that any Iranian politician who is caught dead in the water tends to get blown out of it," a diplomat in Tehran said. He was commenting on Khomeini's tactics of encouraging various political forces, but ensuring that no one ever challenges his own authority.

Thus, the students were encouraged to root out any pro-Western influences, not only symbolized by the United States, but a whole middle ground of moderate politicians.

It was also with Khomeini's tacit blessing that clerical rightists around Ayatollah Mohammad Behesti and other leaders of the Islamic Republican Party were subjected to attack and criticism.

Bani-Sadr's landslide presidential election victory in late January owed a great deal to a Khomeini-encouraged campaign, which helped force the Islamic Republican Party's candidate to withdraw from the race.

Buttressing Bani-Sadr's claims to leadership was Khomeini's action after the presidential victory in naming Bani-Sadr commander-in-chief of the armed forces and chairman of the Revolutionary Council. That seemed to overrule the clerical group's claims Bani-Sadr had no right to govern until parliament's election.

Visibly worried by Khomeini's implicit criticism of his performance last week, Bani-Sadr Monday organized a march past the U.S. Embassy and reviewed the proceedings from the embassy compound's outside wall.

At the same time, Bani-Sadr, who once disdained party politics, is locked in major battle with the Islamic Republican Party, which is backing the students in a dogged rearguard action.

At stake is control of the 270-seat Majlis, or parliament, due for election starting in mid-March in a yet undetermined procedure that could involve either proportional representation or a runoff system.

The composition of parliament is vital since Khomeini has said the new Majlis will determine the release of the hostages. If Bani-Sadr fails to win a majority, his rivals could delay the Americans' liberation indefinitely. w

Beheshti said as much yesterday in suggesting that a full month would be needed after parliament convenes in early April to organize its internal rules and debate the hostage issue.

Only this week has Bani-Sadr managed to dislodge a major Islamic Republican Party cleric from the key Interior Ministry, but not the team at the ministry that still wields crucial influence in overseeing the election campaign and vote.

Similarly, Bani-Sadr has yet to gain control of the state-run radio and television monopoly, where his clerical rivals' influence can be judged by the embassy students' undiminished access to broadcasting.

Bani-Sadr and the other Iranians who want to end the hostage crisis also were reported angered with the U.N. commission's initial failure to understand the stakes involved.