U.S. Ambassador John Gunther Dean escaped unharmed tonight after gunmen in a speeding Mercedes attacked his bulletproof limousine as he was leaving his Hazmieh residence in a convoy.

The ensuing battle between the ambasador's bodyguards and the gunmen left the embassy car demolished on the passenger side, with window glass shattered and tires flat, embassy sources said.

Later this evening, Dean appeared at the gate of the embassy and waved to bystanders but refused to make a statement on the incident. He showed no signs of injury. [The Associate Press, quoting security sources, said Dean's wife Martine and daughter Catherine also were unharmed.]

It was the first attempt on an American ambassador's life in Lebanon since June 16, 1976, when ambassador Francis E. Eloy, economic counselor Robert O. Waring and their chauffeur were kidnaped and killed on their way from West Beirut to East Beirut during the civil war.

[Several hours after the attack on Dean, gunmen with automatic rifles dragged the Spanish ambassador and his wife from their car and drove away in the embasy vehicle. Ambassador Luis Jordana Pozas told the Associated Press. Jordana said five men pushed them from the car in mostly Moslem West Beirut. There was no indication whether the theft of Jordana's car was related to the attack on the American diplomat.]

Today's attack came just hours after Dean said the United States was working with Israel and the United Nations to end the violence among Christian militiamen and Palestinian guerrillas in southern Lebanon. It was his first public statement since Aug. 21, when he created an uproar by condemning an Israeli raid on Palestinian guerilla strongholds in the area. The U.S. State Department later disavowed the statement.

There were conflicting reports about the kind of explosive that was aimed at the ambassador's car. Some local radio stations said it was a rocket, while others said it was a rifle grenade. None of the reports could be confirmed.

The shooting took place as Dean was driving to Beirut. Excited security guards outside the U.S. Embassy told reporters that a spurt of machine-gun fire followed the explosion.

The attackers, who abandoned their car, fled into the woods on the side of the highway, Beirut's official radio said.

Lebanese Army troops and internal security forces were quickly moved to the ambush site and an all-night search was begun to track down the would-be killers. Reliable police sources said two Lebanese suspected of being linked to the assassination attermpt were taken in for questioning.

Following a meeting with Lebanese Foreign Minister Fuad Butros today, Dean stressed that "American policy includes opposition to all acts of violence which ignore or violate the internationally recognized border between Lebanon and Israel."