Two American agricultural advisers and the head of El Salvador's intensely disputed agrarian reform program were slain by unidentified gunmen in the Salvadoran capital late last night.

Michael Hammer, 42, of Potomac, Md., and Mark Pearlman, 36, of Seattle were having coffee at about 11:30 p.m. in the San Salvador Sheraton Hotel with Rodolfo Viera, a peasant union leader and head of the agrarian reform institute, when two men walked up and sprayed them with bullets from automatic pistols, according to a U.S. Embassy spokesman. Hammer and Viera were killed almost instantly. Pearlman died on the way to the hospital.

President Jose Napoleon Duarte and his defense minister promised full cooperation in an investigation to find the killers. No one immediately claimed responsibility for the murders.

[In Washington, a State Department spokesman said, "We are particularly grieved at the deaths of these three men whose lives were dedicated to the building of a just and equitable society in El Salvador. At the time of their deaths they were actively working on behalf of the agrarian reform program, which has brought new hope for a better life to hundreds of thousands of El Salvador's rural poor." Almost 200 persons connected with the reform have been killed in the last nine months, the spokesman said.]

The hotel restaurant was virtually empty at the time. A witness told U.S. officials that the gunmen entered and escaped "very calmly."

Hammer, who had arrived in San Salvador only yesterday morning, was the director of agrarian union development for the American Institute for Free Labor Development in Washington. It is an AFLCIO affiliate that does contract work in union organization for the U.S. Agency for International Development. Pearlman, who had spent the past seven months in El Salvador, was one of two local representatives of the institute.

The slayings bring to seven the number of Americans killed in Ed Salvador in the last month. Four American churchwomen were abducted and murdered on Dec 4. A private American security adviser to the Salvadoran police was killed Dec. 17.

The unprecedented wave of attacks on Americans in a country where approximately 10,000 Salvadorans died in political violence last year has been linked by U.S. officials and Salvadoran politicians to efforts by both the extreme right and the extreme left to further destabilize the shaky U.S.-backed ruling junta.

While the Salvadoran government is increasingly controlled by conservatives intent on bringing law and order to the country, the lefist guerrillas and their political allies are working to form an alternative government and pursue what they have called the "final offensive" in an effort to make the current government untenable before U.S. President-elect Ronald Reagan takes office Jan. 20.

The agrarian reform, begun last March, is the cornerstone of the junta's efforts to liberalize the social and economic structure of the country while winning popular support. It has been under attack from lefist guerrillas, who see it as a threat to their own support, and threat to their own support, and conservatives both inside and outside the government who resent the handover of tens of thousands of acres of prime farmland to the peasantry.

Viera, the object of at least one assassination attempt last year, was the son of peasants. He worked his way up through the ranks of the union as a tough-minded organizer during the last decade.

Despite his important position with the agrarian reform institute, he was known for traveling through the countryside visiting cooperatives in a beat-up old car, and even after the assassination attempt near the town of Santa Tecla last fall he was reluctant to use bodyguards.

In recent months Viera's leadership has been under attack by members of the Christian Democratic Party, which participates with the military in the government. Sources close to Viera said he and his closest adviser, Lionel Gomez, were being pressured to resign because of their outspoken criticism of the junta. Gomez could not be reached for comment.

Viera was also widely reputed to be a supporter and ally of liberal Col. Adolfo Arnoldo Majano, who was forced off the governing junta last month and has been living clandestinely since.

Sources said last month that Viera told the government he would resign his post, but if he did the Salvadoran Peasants' Union would also withdraw from the agrarian reform program. However, he reportedly said, it would not withdraw from the several large farms it now controls. This in effect would leave the farms in the hands of an organization antagonistic to the government and seriously jeopardize the always delicate reform process.

There were unconfirmed rumors in San Salvador last week that Viera would be forced out of the agrarian reform institute when new Cabinet and staff positions are announced on Monday or Tuesday and the call to Hammer in Washington on Friday, asking him to hurry to San Salvador, was thought to be related to that situation.

The role of the American institute for Free Labor Development in EL Salvador has been controversial. In the 1960s and early 1970s it was closely allied with the peasants' union, but the connection was broken after allegations that AIFLD had CIA connections.

Those allegations have since been put to rest, and the institute again became prominent in El Salvador last spring as the U.S. Embassy pressured the new military-civilian government to begin long-promised reforms.

AIFLD, which has country representatives throughout Latin America, has overall contracts of about $15 million with AID and a $1.5 million special contract to help administer the agrarian reform program in El Salvador. This year, according to embassy spokesmen, the United States directed about $35 million to help bolster the project.

[William Doherty, executive director of the institute, said in Washington that the killings came as "a complete and total shock. We don't know who did the killing. It could have been people either from the extreme right or extreme left," he said. "Both have killed many thousands of people down there." Deputy Director Sam Haddad, who promised that the program would continue, said, "We're going to help the farmers one way or another."]

Some of the most radical aspects of the reform, although not yet implemented, were designed by Pearlman's mentor, Roy Prosterman, at the University of Washington. These would have given sharecroppers the tile to the land they traditionally worked.

Pearlman recently had been concentrating on the titling process to give these peasants their land. Both he and Hammer were lawyers.