U.N. Secretary General Kurt Waldheim appeared today to become a key figure in the crisis between the United States and Iran.

The secretary general worked in unusual secrecy throughout the day in an effort to put together an arrangement under which Iran would release the estimated 50 American hostages it still holds in return for U.S. acceptance of the principle that there should be an international tribunal to investigate crimes allegedly committed by the shah.

The United States appeared to be taking Waldheim's role very seriously after Iran's acting Foreign Minister Abol Hassan Bani-Sadr said that U.S. agreement to an investigation of the shah's rule by an impartial party would change the psychological climate, "and after that we can begin discussions with Kurt Waldheim."

Waldheim was in close touch with Ahmad Salamatian, the special representative Bani-Sadr sent to the United Nations and with U.S. officials.

It remained unknown, however, whether Iran's ruler Ayatollah Ruhollah Khomeini supports the approach Bani-Sadr appears to be using. Khomeini has insisted that the shah be returned to Iran to stand trial.

Waldheim refused to make any public statement replying through a spokesman, "No comment" -- when asked about Bani-Sadr's mention of Waldheim as the man through whom the United States and Iran could talk.

Waldheim's activities paralleled attempts begun earlier by the 15 Security Council advocated a plan under which the United States would make a statement critical of the shah in return for the release of the hostages. An international tribunal on the shah's 37 years in power would be held at a later date.

However, it appeared that Waldheim -- not the Security Council -- had become the main channel for talks here. Observers said this may reflect Iran's unhappiness with the Security Council after its earlier call for the release of all hostages.

Security Council members said they were still awaiting a response to their proposal from Salamatian.

In addition, the Waldheim discussions appeared not to include an Iranian demand for an U.S. denunciation of the shah before the release of the hostages. The Carter administration has refused to consider making such a statement and demands that the hostages' release be the first step.

The flurry of negotiations centering on Waldheim's 38th floor offices in the U.N. secretariat came as Moslem diplomats reacted with amazement and alarm to the burning of the U.S. Embassy in Pakistan and the capture of the Great Mosque in Mecca by Moslem extremists.

For many, the events in Pakistan and Saudi Arabia raised the possibility of similar acts of violence in other moderate Moslem nations, trapping the governments in a vise between violently anti-American elements and economic and political ties to Washington.

Initially, even diplomats of traditionally anti-American nations strongly supported the United States against Iran. Iran still is isolated here in a world body dedicated to preserving international law and order, but fears are spreading among some Middle Eastern diplomats that a strong show of U.S. military force could bring new violent outbursts in the region.

Diplomats from moderate Moslem countries express concern that the arrival of U.S. naval ships in the region could further inflame the anti-American feelings that have been unleased -- and exploited -- since Iranian students took over the U.S. Embassy in Tehran.