Four Americans were killed here today when unidentified terrorists armed with automatic weapons ambushed their car in an Istanbul suburb.

Turkish police said the victims included a U.S. serviceman and three civilians employed by a Boeing Aircraft Co. subsidiary and on a contract at the Cakmakli military base, a NATO munitions depot near here run jointly by Turkish and U.S. military authorities.

Although no one claimed responsibility for the slayings, Turkey's Deputy Prime Minister Ekrem Ceyhun accused "leftist terrorists." Expressing Ankara's "deep grief and regret," he said the "government is resolved to eradicate terrorism in Turkey and would do its utmost to apprehend the assassins and ensure the security of diplomats in Turkey."

A government spokesman described the killing as a "most dastardly act" designed to tarnish Turkey's internatinal image and "undermine the vital Turkish-American relationship."

Turkish police identified the serviceman as James Smith. The three civilians were identified as Jim Clark, Elmer Cooper and Robert French, all employes of Boeing Services International. No other details about the victims were available.

Three other Americans, two military officers and a teacher, were killed in three separate incidents in Turkey earlier this year. But today's attack was the worst on any foreigners here in recent memory.

Extreme leftist groups have struck U.S. targets in Turkey on numerous occasions in an effort to hamper activities of about 5,000 U.S. military personnel stationed at two dozen U.S. and NATO bases here. These included the machine-gunning of an empty officers club and two bombings of the Turkish-American Association in Ankara.

Much of Turkey has been under martial law because of political violence between leftist and rightist factions in which more than 2,000 died during the past two years.

However, Turkey was one of the few Moslem countries from which the United States did not feel it necessary to pull out diplomatic personnel after the attacks on U.S. embassies in Iran, Pakistan and Libya.

Although 98 percent of the population is Moslem, Turkey is a secular state. There have been few signs of sympathy in Turkey for the Moslem extremists holding 50 Americans hostage in Tehran. Turkish leaders have criticized the Tehran seizure although in mild terms calculated to maintain good relations with their oil-providing neighbor.

According to eyewitnesses, the four Americans were en route from the Cakmakli base in a military car chauffered by a Turkish driver when they were attacked.

The four were about to get out of the vehicle near their homes in the Florya district when five men and one woman armed with automatic weapons rushed up, hauled them from the car and shot them before fleeing in a blue sedan.

Police said one American died instantly while the others died on the way to the hospital.

An employe of Boeing Services International, Leo Underwood, was one of the first on the scene after the shooting near Istanbul's Yesilkoy International Airport. He said he was on his way home when "all of a sudden I heard gunshots. It sounded to me like between 10 and 15 shots, automatic fire.

"I told my wife to get away from the window and we took cover until we were sure it was over. I moved slowly outside and saw three bodies. One was deceased. I rushed the two others to a nearby hospital but they were dead on arrival."

Underwood said he had not seen a fourth victim. Police said he was picked up by another person and taken to the Admiral Bristol Hospital, where doctors pronounced him dead.

The Turkish driver was not hurt, according to police.

Instanbul police and Army troops set up roadblocks around this bustling city of 4.5 million last night, searching cars and passengers.

In the assassination in April and May of two U.S. officers, Turkish authorities later arrested 13 members of the Marxist-Leninist Armed Propaganda Union, which had claimed responsibility. The identities of the gunmen who killed U.S. teacher David Goodman in June are still unknown.