Violence directed at American diplomats exploded anew in the Middle East yesterday as an angry Moslem mob attacked and burned the U.S. Embassy in Islamabad, Pakistan. At least 100 persons escaped from the burning embassy building, but a Marine guard was shot and killed in the attack.

Two other sieges conducted by Islamic extremists continued. In Tehran, Iranian militants threatened to kill their 49 remaining American hostages and all other Americans in Iran if there is "the slightest military intervention" by the United States to rescue the hostages.

Saudi Arabian soliders, meanwhile, surrounded the Great Mosque in Mecca, Islam's holiest city, and reportedly exchanged fire with well-armed extremists who have taken Saudi hostages in an apparent attempt to proclaim a new messiah in the mosque.

The Saudi government said the attackers were a "gang operating outside the Moslem religion" and without political aims. Officials in Saudi Arabia and Washington emphasized that the assault did not appear to have any overt anti-American aims.

But it sent shock waves through the conservative Islamic kingdom, the world's largest oil exporter and the strongest remaining American ally in the Persian Gulf, and rebounded into Pakistan, where unfounded rumors that American and Israeli agents had mounted the Mecca attack evidently triggered the mob assault in Islamabad.

President Carter, in seclusion at Camp David for the Thanksgiving holidays, was awakened by a 4 a.m. telephone call from Secretary of State Cyrus Vance reporting the invasion of the embassy compound in Islamabad by thousands of Pakistanis. t

Vance immediately appealed for help from Pakistani President Mohammed Zia ul-Haq, but it was five hours before Pakistani troops cleared the embassy roof of armed demonstrators and led the American diplomats and embassy employes from the burning building.

In nearly simultaneous attacks that U.S. intelligence officials in Washington said were too closely coordinated to have been spontaneous responses to rumors about the Mecca siege, Pakistani mobs also attacked the U.S. consulate in Karachi, destroyed the American Library in Lahore and burned the American Cultural Center in Rawalpindi.

Carter, who Tuesday raised for the first time the possibility that he would consider military action to try to free the hostages in Tehran, made no overt move in that direction. The Pentagon denied reports that American units had been placed on alert.

Carter's press secretary, Jody Powell, responded to the new Iranian threats against Americans with a sharp reassertion that the United States holds Iran's government "strictly accountable" for the safety of the hostages and other Americans, and warned that Iran would be making "a most serious mistake" by disregarding the warning.

Vance called in about 30 ambassadors from Moslem countries early yesterday to stress U.S. concern about the safety of Americans abroad and to ask them to help in persuading Iran to free the hostages. The rest of the diplomatic corps in Washington received the same message in later meetings.

At the United Nations, Security General Kurt Waldheim worked in unusual secrecy, apparently trying to arrange a trade of the hostages in return for the appointment of an international tribunal to investigate the deposed shah of Iran, who remained hospitalized in New York. France led a new international chorus of appeals to Iran to free the U.S. Diplomats.

The day's turmoil did not have an immediately serious impact on world finanical markets. After a morning of uncertainly, trading on the New York Stock Exchange and the dollar's value in European markets returned to opening levels. Gold prices rose $8 to $10.