A powerful bomb shattered the U.S. Embassy here today, killing at least 32 persons, including six Americans, and wounding at least 95 others in the worst attack ever against an American target in Lebanon.

U.S. special envoys Philip Habib and Morris Draper were not in the building when the bomb exploded at midday, and Ambassador Robert Dillon, who was in his office, escaped with minor cuts. The American victims were identified in Washington as two foreign service officers, two Agency for International Development employes and two Army sergeants. Most of the others killed and wounded were believed to be Lebanese.

Police said they believe the bomb was inside a pickup truck driven to the embassy, although the source of the explosion remained officially unknown. Responsibility for the attack was claimed in telephone calls by an Islamic group called Moslem Holy War, which identified itself as a supporter of Iranian leader Ayatollah Ruhollah Khomeini.

The central section of the seven-story, salmon pink building on the West Beirut seafront collapsed like an accordion in the blast. An embassy employe described the explosion as a sudden burst of light, not noise, with objects flying through the air. The wings of the embassy structure were badly damaged but still standing.

After the explosion, thick brown smoke enveloped the building, and pandemonium erupted. Reporters rushed to the scene and saw three cars burning in front of the embassy. From the top floors, the screams and cries of trapped employes could be heard.

Lebanese Army and U.S. Marine helicopters quickly arrived on the roof of the building to rescue those trapped. Lebanese civil defense units, Red Cross and Red Crescent workers charged into the building, bringing out what appeared to be heaps of flesh, nothing resembling bodies.

[In Washington, President Reagan declared that "this criminal attack . . . will not deter" the United States from "doing what we know to be right" in the search for peace in the Middle East. Details on A17.]

American Marines, French and Lebanese troops and police rescue teams, using floodlights, were still searching this evening amid the rubble for those trapped and those injured. The number of casualties was expected to mount.

No official breakdown of casualties was given here, but the name of one AID employe, William McIntyre, was listed in local reports as among those killed. Embassy press secretary John Reid and security officer David Roberts were said to be among those injured.

Confirmation that at least six Americans had been killed came from Undersecretary of State for Political Affairs Lawrence Eagleburger in Washington as he left a briefing for the House Foreign Affairs Committee. Eagleburger gave no names, but the Army identified two of the victims as Sgt. 1st Class Richard Twine, 36, of Salop, England, and Staff Sgt. Ben H. Maxwell, 26, of Appomattox, Va., members of an Army team that was training Lebanese troops. A third member of the team, Staff Sgt. Mark E. Salazar, 30, of San Gabriel, Calif., was missing and believed dead, the Army said.

While there were conflicting statements about casualties from Beirut hospitals, doctors and police, most of the victims were believed to be Lebanese. This was because the most severely damaged part of the embassy was the visa section, crowded with applicants, and because the blast and flames from the explosion were said to have thrown strollers across the two-lane highway on the beachfront sidewalk where Lebanese vendors and passers-by gather daily.

How the explosion occurred and who was responsible for it remained a mystery this evening.

Although the prevailing suspicion was that it was caused by a car bomb, a favorite weapon of terrorists here, Dillon said that was only speculation.

In the most dramatic version, the right-wing Christian Phalangist Party's Voice of Lebanon radio said a "suicide terrorist" in a car bearing false diplomatic plates and laden with explosives charged the heavily guarded circular driveway of the embassy, detonating the bomb and instantly killing himself. Other reports suggested that the bomb may have been placed in a police vehicle or in a GMC pickup truck.

Minutes after the blast, which occurred at 1:05 p.m., an anonymous caller telephoned Agence France-Presse and claimed responsibility for the attack in the name of a group calling itself Al Jihad al Islami, Arabic for "Moslem Holy War."

Al Liwa, a Beirut newspaper, also received a telephone call from a man claiming to be a member of the same group, which he said took credit for the attack today.

"This is part of the Iranian revolution's campaign against imperialist targets throughout the world," the anonymous caller said. "We shall keep striking at any imperialist presence in Lebanon, including the multinational force," Al Liwa quoted the caller as saying in Arabic. Staffers at the newspaper said the man then abruptly hung up.

The callers are believed by police here to be members of pro-Iranian Lebanese Shiite Moslem factions. They have claimed responsibility for several attacks on the multinational peace-keeping force in Lebanon, including one on March 16 in which five U.S. marines were slightly wounded.

In Washington, Eagleburger said the same group has claimed responsibility for terrorist acts in the past, and that there was "no present evidence to suggest PLO involvement" in the embassy attack.

Ambassador Dillon told reporters that he had been in his seventh-floor office overlooking the sea preparing to go jogging.

"I was standing up with a telephone in one hand and a T-shirt in the other," the lanky, silver-haired Dillon said. "I was preparing to go out and jog, when all of a sudden my office collapsed around me."

Still dressed in a blood-flecked track suit top and dress gray trousers, five hours after the explosion, Dillon talked about the experience.

"The staff removed some pieces of rubble from on top of me. I walked out of a broken window down a few floors and out."

Almost immediately Dillon and his political officer, Ryan Crocker, began directing rescue operations.

Special envoys Habib and Draper were at the presidential palace in Baabda, outside Beirut, meeting with Lebanese Foreign Minister Elie Salem, when the blast occurred.

Draper's wife, Roberta Hornig, a former Washington Star reporter, was in the building at the time of the explosion. The envoy rushed around asking survivors and Marine security guards about his wife. When he found her, only slightly cut and bruised, they embraced.

Louise Pennant, Habib's secretary, speaking of the explosion, remembered only that she could see walls collapsing on fellow employes.

After the explosion, downtown Beirut was filled with the wail of sirens from fire trucks and ambulances.

American and French ships cruised to a position facing the embassy from the sea, about a quarter mile offshore. The American ship was the helicopter carrier USS Guadalcanal of the 6th Fleet Special Task Force in the Mediterranean. U.S. marines said the ships came to help in rescue operations, but most of the casualties went to Beirut hospitals.

Lebanese President Amin Gemayel came to the scene and expressed sympathy. Prime Minister Shafiq Wazzan also inspected the damage.

"Both feel like I do that we cannot let this stop our work," Dillon said. "I don't see why it should affect the peace process. We intend to go ahead. The Habib and Draper missions are continuing."

Gemayel sent a telegram of condolences to President Reagan in which he said, "I am confident that your initiative will continue despite the threats and blackmail. I was severely hit by this criminal act.

"The Lebanese people and myself express our deepest condolences to the families of U.S. victims. The cross of peace is the burden of the courageous."

Wazzan said, "The attack came at a time when everyone was cooperating and calling on the world to be on our side and help save us."

"Our nation never expected this blow to happen," he said.

The attack today followed two others last night against the French contingent and U.S. marines in the multinational peace-keeping force .

Unidentified assailants threw explosive charges at a French post near the Shatila Palestinian refugee camp from a white Mercedes car.

A bullet went through the trousers of U.S. Marine Pfc. Kenneth E. Simpson of Wellston, Ohio, but did not wound him. Simpson said that he fired back but did not know that he had injured his assailants.

But the attack today was the worst yet on Americans here. U.S. Ambassador Francis Meloy was killed in an assault here in 1976 and Dillon's predecessor, John Gunther Dean, was the target of two attacks. A sniper fired on his motorcade three years ago and there was a rocket attack against him.

There was renewed tension in the air this evening as soldiers manned armored personnel carriers around the area and both American and Lebanese troops stood nervous guard on the balconies of hotels nearby.