Jose Napoleon Duarte was explaining his troubles with the coup-plotting Salvadoran right when an urgent call came in: the insurgent left had just set fire to a large cotton warehouse.

That is the way the president of El Salvador exercises power, one eye on extreme rightists maneuvering to lure the Army back into government and another on leftist rebels fighting to make a revolution in their violent homeland.

Duarte has ruled since his inauguration eight months ago with a measured mix of bold gestures and ambiguous caution. A large part of the Reagan administration's policy for this part of the world rides on the center-left Christian Democratic leader's ability to continue calculating the right proportions.

Duarte, 58, an engineer educated at Notre Dame University before he became a politician, acknowledges the risks. He won the presidential election in 1972 but was promptly arrested by the Army, abused and shipped out of the country. A repeat of that episode, which key guerrilla leaders cite as crucial in their decision to take up arms, would undermine U.S. arguments against that revolt and dash Washington's portrayal of El Salvador as a nascent democracy.

The fears that an American embrace, including covert campaign funds, would diminish Duarte's authority with the Army, or that peace talks with the guerrillas would produce mutiny in the barracks, or that ultra-right political rivals would have the colonels on their side -- none of it has yet come to pass.

"The people of the extreme right and the people of the political right thought that even if I took office, it was a matter of weeks, and they would destabilize the government," he says over rich Salvadoran coffee. "And they were expecting to count on the armed forces to overthrow the government. They were basing their conduct on the idea that when I started to act in the direction of controlling the armed forces and exercising authority, there was going to be confrontation, and that these confrontations were going to weaken me and my position.

"They were talking about 15 days, then two months, then Christmas," he adds, satisfaction coloring his voice. "But things are different."

Not that different, according to rebel leaders. At a briefing last week in Mexico City, they explained the current stall in Duarte's talks with the insurgency as the result of pressure from the Army and the right. Some of Duarte's aids, using similar language, have ascribed the delay to breakdown of a fragile consensus that Duarte built with the momentum of his first peace proposal.

The president says the rebel leaders, with hard-line demands presented Nov. 30 at the second session, shattered a spirit of conciliation created at the first session Oct. 15. Until the insurgents show they are ready to carry on a "serious dialogue" -- defined as discussion of Duarte's initial proposal -- he cannot pursue a third round of meetings, the president explains.

The decision to renew talks is entirely his, Duarte insists, because the armed forces have accorded "complete and absolute support" for his peace efforts.

Similarly, as Duarte recalls it, the decision to make the ice-breaking proposal Oct. 8 in a speech to the United Nations General Assembly was the president's alone. He handed a copy of the speech to Gen. Carlos Eugenio Vides Casanova, the defense minister, only half an hour before boarding a plane for New York, Duarte says, and the chief of staff, Gen. Adolfo Blandon, had learned of it one day before.

"In this country, nobody thought it was possible to make the declaration, and not only to make the declaration, but have the dialogue," Duarte says now, "and not only have the dialogue, but making the armed forces protect the areas where rebel leaders came , including protecting guerrilla commanders in order to have the dialogue, and to make the minister and the vice minister of defense part of the delegation."

This is where the right goes wrong, Duarte says. Land-owning and business leaders here are used to having the officer corps enforce the radical right's sentiments. But they are finding that El Salvador's colonels have adopted a new set of masters, including the president, he adds.

When the Army command turned down Duarte's proposal for a Christmas cease-fire, and the president responded by meeting with about 60 officers for more than five hours, Duarte says, the right wing thought it smelled the makings of a coup d'etat. So "destabilizing" began, including sharpened political opposition in the Legislative Assembly and challenges to presidential authority, Duarte recalls.

"They thought, 'Now we have him,' " the president adds, savoring what he is about to say.

"But what we got out of that meeting was the complete and absolute support of the Army for my position, on the whole thing, whatever it is," he declares. "So this was a demonstration of confidence."

He adds: "If I started out with a skeptical Army, I think that little by little the Army officers have been, up to the moment, I would say, not absolutely convinced, but honestly have reasoned that I was their best choice, that I am the best alternative, counting all factors."

The key factor seems to have been the "little by little." Despite clear campaign promises, Duarte delayed so long in approaching the peace talks that observers had begun to write off the idea as impossible pending personnel changes in the officer corps.

During the first summer of his presidency, moreover, he concentrated on building contacts in the officer corps by frequent visits to regional brigade headquarters, imitating a tactic of ex-major Roberto d'Aubuisson, his rightist election rival. When guerrilla forces attacked a dam in the center of the country, Duarte flew by helicopter to the scene to confer with commanders, ordering them to attack.

Duarte has moved with caution to punish offending military officers. Four have been transferred, but not punished, on suspicion that they participated in death squad activities. Two others were dismissed from the armed forces, also unpunished, including a lieutenant implicated in the murders of two U.S. land reform advisers.

Duarte went out of his way to say that the May 24 conviction of five national guardsmen for murdering four American churchwomen -- long an irritant in the U.S. Congress -- will not be followed by investigation of how their crime was covered up for five years. Vides Casanova, the defense minister, headed the National Guard at the time of the murders.

Duarte's appearances in Washington, full of pledges to end human rights abuses and punish those already committed, also have created a new climate in Congress for the administration's military aid requests. In some ways, therefore, Duarte has become the military's fundraiser. U.S. aid money more than doubled, to $196 million, after his election last spring.