Malcolm Kerr, president of the American University of Beirut and a noted academic, was shot and killed in his campus office building in west Beirut today by two assailants who escaped.

The assassination, the first of a prominent civilian American in the current wave of violence here, shocked the country and stirred fears that similar figures might become targets.

Four hours after the attack, a man who did not identify himself telephoned Agence France-Presse to say that Islamic Jihad, a pro-Iranian group that claimed responsibility for the devastating suicide car bombing of the U.S. Marine compound last October, was responsible for killing Kerr as well as for kidnaping the consul general of the Saudi Arabian Embassy here Tuesday.

"We are responsible for the assassination of the president of the American University of Beirut, who was a victim of the American military presence in Lebanon," the caller told AFP.

"We also vow that not a single American or Frenchman will remain on this soil. We will not stop these methods and we will pursue all Lebanese and Arab agents whether they are leaders, politicians or military men," he said. He warned that the Saudi diplomat might be killed, too.

President Reagan denounced the "despicable assassins" who killed Kerr and said that his death "must strengthen our resolve not to give in to the acts of terrorists," according to a statement released by the White House.

The assassination was widely condemned by Lebanese officials and leaders of the country's warring sectarian factions. Information Minister Roger Shikhani called it a "tragedy" for all Lebanese.

Druze leader Walid Jumblatt, a graduate of the university, praised Kerr for his "moderate voice" and hailed his steadfastness in pursuing a neutral course against what Jumblatt said were pressures from the Christian Phalangists.

Kerr, 52, was shot in the hallway leading to his third-floor office in College Hall, the main administration center, shortly after 9 a.m. as he was returning from an appointment in another building.

University Vice President Samir Thabet said two gunmen were apparently waiting for Kerr and fired two shots from a 7.65mm pistol fitted with a silencer.

Kerr, who had just gotten out of the elevator, was hit in the head, according to Thabet and several other university officials who rushed out of nearby offices. "He suffered serious brain damage but his heart was still beating," Thabet said.

Kerr, who is survived by his wife Ann and four children, was pronounced dead upon arrival at the nearby American University Hospital.

Coroner Ahmed Harati told Beirut radio that a single bullet had entered Kerr's right temple and exited just above the left ear, causing massive damage to the brain and instantaneous death.

Thabet said the two gunmen apparently had escaped from the building and the walled campus grounds before police and Army soldiers who rushed to the scene could close the gates.

The Army sealed off the sprawling, tree-shaded 73-acre campus near the city's northern waterfront all day long searching for the gunmen. Classes were suspended until Monday to allow time for Kerr's funeral and a period of mourning.

Trustees of the 118-year-old university, one of the Arab world's most respected centers of learning, were reported to be holding an emergency meeting in New York to decide what to do next in the wake of the assassination.

Thabet said he had already gotten a call from the board chairman, Najeeb Halaby, who had assured him that "we are going to carry on."

Nonetheless, Thabet said he felt it would now be extremely difficult to find anyone willing to take the position of president. Kerr's predecessor, David Dodge, was kidnaped from the campus in July 1982, reportedly by Shiite Moslem gunmen, and held for a year in Iran before being released. Kerr was born in Beirut and lived here as a child. His father was a biochemistry professor at the American University's medical school and his mother was the university's dean of students.

Kerr, a Princeton graduate, got his master's degree here and a doctorate at Johns Hopkins and taught here during the late 1950s and again in the 1960s during a sabbatical from the University of California at Los Angeles, where he spent 20 years in the political science department, including a period as its chairman. From 1977-79 he was director of the Near Eastern Center at UCLA.

In September 1978, Kerr's automobile was firebombed at his home in Pacific Palisades, Calif. Los Angeles police said a caller claimed responsibility on behalf of a group called the Jewish Armed Resistance, but the motive was unclear. Kerr, however, had long been identified with Arab affairs.

He was fluent in Arabic and a scholar highly respected in the United States and in the Middle East. He had published books about Lebanon's history and other Middle East topics--including his most recent, "The Elusive Peace in the Middle East," in 1975--and thus was widely regarded as a natural choice to become the university's president.

Thabet said that Kerr, who became president in July 1982 after the kidnaping of Dodge, had been extremely popular with most of the 4,850 students, had no personal enemies and thus had not taken any special security precautions for himself, such as hiring a bodyguard.

Nonetheless, ever since his arrival here, Kerr had fought an uphill battle to keep the university from being engulfed by the political troubles and sectarian warfare rife in Lebanon and slowly closing in on the west Beirut campus.

He arrived in the middle of the Israeli invasion of Lebanon and at one point personally stood down an Israeli armored personnel carrier that crashed through a campus gate.

"I wish they'd knocked, but their way of knocking is to crash through with a tank," Kerr told an Associated Press reporter at the time. A few days later Kerr turned down a request by an Israeli general for a "tour" of the campus, telling him it was "too delicate."

Last fall, Kerr touched off student strikes with a directive that students must sign a pledge to refrain from all political activity while on campus. But he engineered a compromise that allowed the academic year to begin with only a two-week delay despite the fighting that kept Beirut's airport closed throughout September.

Kerr managed to keep the university functioning in a fairly normal manner despite the difficulties and at least one Phalangist student attempt to close it down.

Today, students seemed deeply concerned about the fate of the university and whether it would remain open.

"We are very sad and shocked," said Mohammed Khuja, head of the debating club and a member of the student council. "We don't understand why. The only ones who wanted this are those who want to close the university," he said, referring to the Christian Phalangists.

"What is happening here is not isolated from what is happening in the rest of the country," Khuja, a Moslem, said.

This was a sentiment widely expressed here today by both Lebanese and foreign residents who feared Kerr's assassination might herald the start of a broader campaign aimed at American and French civilians in particular, but foreigners in general.

Western diplomatic sources said there had been reports before today's slaying that U.S. citizens might become targets, and a U.S. Embassy spokesman said there was concern now about the safety of the 5,000 American civilians in the country.

The spokesman said the entire U.S. official community was "shocked, saddened and angered" by what he called "the savage and unprovoked killing" of Kerr. He said there were no plans to ask American residents to leave the country.

Meanwhile, there was still no word on the whereabouts of the kidnaped Saudi consul general, Hussein Abdullah Farrash, 45. The Saudi embassy said late last night that it had received word he was still alive.

But the caller to AFP who claimed responsibility on behalf of the Islamic Jihad said Farrash was being judged "according to Islamic law" and that his body would soon be "thrown out."

Efforts to free Farrash have involved contacts between Saudi Crown Prince Abdullah and Syrian President Hafez Assad--suggesting that the Saudis think Syrian-backed Shiite groups may be involved.

The kidnaping is presumed to be an effort to upset Saudi mediation efforts here toward a security plan under which the Lebanese Army would expand its authority.

Saudi Foreign Minister Saud Faisal said in an interview published in a Saudi newspaper today that the kidnaping appeared meant "to exert pressure on the kingdom to halt its good offices for Lebanese reconciliation." But he said Saudi Arabia would continue its efforts "whatever the circumstances."

Callers claiming to be from Islamic Jihad have claimed responsibility for several bombings here, including those at the U.S. Embassy last April, the Marine compound at the airport in which 242 persons were killed last October, and the French military headquarters the same day, which killed 58 soldiers.

On Dec. 21, Islamic Jihad said that if American and French forces did not leave Lebanon within 10 days, it would begin a larger campaign against them and "the ground will tremble under their feet."