Resentment intensified today within the American and foreign diplomatic community about the failure of the Paskistani government to move quickly to rescue the 90 persons trapped by a mob inside the American Embassy yesterday.

The U.S. mission, with its embassy buildings destroyed during the seven-hour siege, said it was cutting back the number of American officials and their dependents by more than 75 percent.

[News services reported early Friday that 309 Americans were evacuated from Islamabad, including 40 persons not connected with the government.]

The American death toll was raised to two today as the charred body of Army Warrant Officer Bryan Ellis, 30, was found in his gutted apartment in the embassy compound.

In addition, the burned bodies of twomen believed to be Pakistani employes of the embassy were found just outside the steel-encased code room in which the embassy workers took refuge yesterday while fire raged around them and the mob of thousands surged below. and at least two demonstrators were reported to have died today of injuries suffered yesterday.

The Complaints by senior American diplomats here conflicted with statement of congratulations that President Carter and Secretary of State Cyrus R. Vance sent to Pakistan President Mohammed Zia ul-Haq late yesterday after the rescue took place. The embassy building was completely destroyed by fire.

"S- - -. They didn't do s- - -," said Navy Commander Charles W. Monaghan, 43, who added that his six tours in Vietnam "were easy compared to this."

In addition to the violence at the embassy, where Marine Cpl. Steven Crowley, 19, was killed trying to defend the compound, there were anti-American incidents yesterdy in four cities in Pakistan. All apparently were sparked by rumors that the United States had invaded the Great Mosque in Mecca, the holiest of holy places for Moslems.

In Lahore today, police used tear gas and sticks to disperse protesters who wanted to go to the American Center there, and some policemen were injured, Reuter reported.

[The students had earlier made speeches condemning the seizure of the Great Mosque, the news agency added.]

[In Karachi, shopping centers, bazaars and most schools and colleges were closed as students demonstrated agaisnt the occupation of the mosque, the Reuter report said.]

Beyond that, informed Western and Asian diplomatic sources here agreed today, the violence showed a deepseated latent strain of anti-Americanism among Pakistanis that was not evident in the official actions of the government.

"I had not believed there was any substantive anti-Americanism in this country," said U.S. Ambassador Arthur W. Hummel, who then repeated the phrase "I had not believed," with the emphasis on not, to indicate his views may have changed.

Whatever the feelings of the mob, no diplomat here could explain the slow response of the Army-run martial law government to the attack, which started around noon and was not over until 7 p.m., when 90 diplomats and Pakistani employes escaped the blazing building through a steel hatch on the roof.

According to all reports here, the government sent a few police to the embassy and they were quickly overwhelmed by the mob, who took their guns. Although three military helicopters wheeled overhead, they appeared to do nothing to thwart the mob, according to diplomats who watched the scene from nearby embassies.

Ambassador Hummel refused to be drawn into the controversy. He said judgments of the Pakistan government's performance will have to be made later. He added, however, "I do not attempt to say the assistance was prompt."

Some U.S. diplomats here speculated that the statements by Carter and Vance were made on the basis of early reports from the embassy, when the situation looked less grim and when Pakistani officials kept promising police and troops were on their way.

"The fact is," said one diplomat, they lied."

The official U.S. statements thanked Zia for Pakistan's help in rescuing the trapped employes. There was some speculation here that they were aimed over the head of Pakistan at Iran, where militant students are holding American hostages in the U.S. Embassy in Tehran.

Zia spoke to Carter by telephone last night to express "deep regret" and to apologize for the attack.

It appears certain that the attack on the embassy here started when busloads of students from the nearby Quaid-i-Azam University raced to the embassy compound to protest the rumored U.S. attack on Mecca.

One professor at the university described how students rushed into his class at about 10 a.m. Wednesday, spread the rumor of the U.S. invasion of the mosque, said they should avenge that act, then hopped into university buses and roared off to the embassy. When the first busloads were repulsed by police, they went back to get reinforcements, said embassy public affairs officer James Thurber.

What was surprising to many here was the way that many Pakistanis, including some who are well-educated intellectuals, believed the rumor was true. One well-known newspaper editor for instance, said when he first heard of the attack on the Great Mosque in Mecca he was sure it could only be the Americans or the Israelis.

"Entenbbe is on everybody's mind," he said. "People here believed for the last two or three years that Israel is planning such a stroke -- to drop para-troopers on Mecca or Medina [islam's second holiest city] or both."

He said when he heard of the attack on the Great Mosque, he thought it was an American task force beginning to take full control of the oil-rich Arabian Gulf.

"Where religion is concerned and where Islam is concerned," said Hummel, "this country has often shown violence. There have often been tensions between different Moslem groups. But so far as I know this is the first time religious tensions through a combination of misleading rumors have been directed at Westerners."

Diplomats here were puzzled, however, over what Zia's government might gain by allowing the anti-American mob violence. Some suggested the martial law government was caught by surprise and was not able to mobilize its forces in time to prevent the destruction of the embassy.

Others said that Zia, who some believe has only a shaky hold on the country after canceling elections last month and tightening his grip on the nation, feared setting up a confrontation between the Army and students who formed the vanguard of the mob.

There were also differing opinions as to whether the mob violence here and elsewhere in Pakistan was spontaneous or planned. One knowledgeable diplomat said the fact that U.S. commercial instillations -- including American Express, Bank of America and Pan American Airways -- were attacked at the same time indicated a planned and coordinated effort.

But an equally knowledgeable diplomat took the opposite view. He said he believes the actions were started spontaneously by students, but were quickly seized on by political opponents of Zia to make the present government look bad.

With the $21 million, six-year-old embassy totally destroyed, U.S. diplomats moved their headquarters into the offices that had been used by the U.S. Agency for International Development mission here, which is being phased out. The mobs did not touch that building, which is located away from the embassy.

Hummel announced that all dependents of embassy personnel and all non-essential staff members would be evacuated Friday by a chartered Pan American jumbo jet whose destination is Washington.

After working on the lists all day, diplomats agreed that about 300 dependents and nonessential embassy personnel will leave Friday. This leaves about 70 people to man the embassy here and other government installations around the country.

[A State Department spokesman in Washington said that about 100 private American citizens will also be on the chartered plane Friday. He said they were leaving entirely of their own volition and that the U.S. government had not officially recommended their departure.]