Secretary of State Edmund S. Muskie unexpectedly met here today with Iraqi Foreign Minister Saadoun Hammadi, who urged that the United States not interfere "in any way" in the war between Iraq and Iran.

Although both were reluctant to discuss details of the hastily arranged meeting, reliable sources said there was nothing in their discussions to raise hopes for a quick end to the nine-day conflict between the two neighboring Persian Gulf countries.

Instead, Muskie emphasized the concern of the United States that the fighting not impede the flow of oil through the gulf to consuming nations. On the Iraqi side, Hammadi stressed that Western interests will best be served by the United States remaining strictly neutral and not pursuing ideas such as injecting a multinational naval force into the area to ensure free passage of shipping.

Their meeting came as diplomats here were preparing to write off as a failure the effort by Pakistan's President Mohammed Zia ul-Hag, acting on behalf of the Islamic bloc of nations, to nudge Iran and Iraq toward a cease-fire.

Zia, who visited both Tehran and Baghdad, is expected to arrive in New York late tonight or early Wednesday for discussions about his mission. During a stopover in Paris today, he replied in a pessimistic tone to questions about whether he could report any progress.

Asked about prospects for an early cease-fire, Zia said, "I wish there were, but I am hopeful and I always look for the greener side."

U.N. Secretary General Kurt Waldheim reported to the Security Council tonight that neither Zia's mission nor his own efforts to intercede have produced any results so far.

Iraqi President Saddam Hussein sent a letter to Waldeim yesterday saying Iraq would accept a cease-fire. Although Iran's leaders have ignored U.N. pleas and vowed to continue fighting, Waldheim was able to offer one flicker of hope by revealing that Iran had promised to send him a response on Wednesday morning.

If Iran still refuses to accept outside mediation, diplomatic sources here said, the effect will be to derail, at least for the time being, any hope of resolving the conflict through the United Nations. In the event, the sources added, the world body will be forced to move into a holding pattern and hope that events gradually will cause Iran to moderate its stance.

However, Iran's revolutionary leaders so far have vowed to continue fighting.

With Iran refusing to accept outside mediation, diplomatic sources here said any hope of resolving the conflict through the United Nations appears to have been sidetracked. The sources said that while the Security Council is likely to continue discussing possible new initiatives, there is little that the world body can do now except move into a holding pattern and hope that events gradually moderate Iran's uncompromising stance.

It was against this background of pessimism that the meeting between Muskie and Hammadi took place. The two countries do not have formal diplomatic relations, but U.S. officials said Iraq signaled its willingness to hold talks while both men are here for the U.N. General Assembly, and Muskie responded by requesting a meeting.

To reinforce U.S. professions of neutrality in the conflict, U.S. officials announced that Muskie also had offered to meet with the charge d'affaires of Iran's U.N. Mission or any other designated Iranian representative. However, the officials said, as of last night, Iran had made no response.

After the 35-minute meeting, Hammadi said his purpuse had been to emphasize personally to Muskie that his forcing Iran to recognize Iraqi sovereignty over certain disputed border areas and waters within the gulf.

The Iraqi minister also said he told Muskie "in the most urgent possible terms" that Iraq has no intention of interfering with shipping to and from other oil-exporting countries in the Persian Gulf and that the best way to ensure continued flows of oil would be for the United States to maintain a strict hands-off policy.

He did not elaborate. But reliable sources said the Iraqis apparently are concerned both by rumors that the United States might "tilt" toward Iran and the knowledge that the United States is exploring with its allies the possible formation of a naval force to prevent closure of the Strait of Hormuz, which commands the entrance to the gulf.

Hammadi said that Muskie had reiterated the U.S. neutrality enunciated by President Carter at the outset of the conflict. But he added: "He [Muskie] was speaking of the past. We are talking about the future."

On the American side, Muskie issued a statement after the meeting saying he had "stressed the importance of the area including its oil resources to the West" and had "urged the cessation of hostilities and early negotiations without preconditions."