A major aim of the rapidly escalating U.S. military presence in and around Honduras is to provide a protective shield for this country as U.S.-backed rebel forces operating along the border with neighboring Nicaragua expand their efforts to overthrow the Sandinista government there, according to senior U.S. and Honduran military officials.

Gen. Gustavo Alvarez, commander of the Honduran armed forces, said last night in an interview that the scheduled arrival of as many as 4,000 U.S. troops for joint maneuvers here in the next few months and a flotilla of warships off both coasts of the Central American isthmus should "dissuade" the Nicaraguans from making any overt move against Honduras.

U.S. officials said that a function of the U.S. troop presence also is to calm Honduran worries and thus avoid any rash action by the military here as border tensions increase. As one source close to Gen. Alvarez put it, the U.S. presence should "confine the ball game to Nicaragua itself."

Alvarez was careful to deny the well-documented presence of the rebels' camps inside Honduras but warned that if--"out of desperation"--the Sandinistas were to launch an attack on Honduras, their incursion "would be smashed."

The Honduran commander added, however, that any response by his troops would be "very prudent" and "reasonable."

"We do not want to fall into an escalation of violence with Nicaragua. We do not want to provoke a war with Nicaragua," Alvarez said.

The complex calculations that appeared to surround recent Reagan administration decisions to raise the visible role of the United States in Central America reflect persistent difficulties in judging the behavior of Washington's friends as well as its foes in the region.

During the past few weeks Alvarez has emerged as one of the most controversial and important players of the current drama.

Alvarez's powerful position, his anticommunist convictions and his blunt talk have led Nicaraguan leaders, including Foreign Minister Miguel D'Escoto, to warn that the United States is "creating a monster" by giving the Honduran commander ever greater military force.

The general's backers, including Honduras' elected president, Roberto Suazo Cordova, picture him as a capable, charismatic defender of a developing democratic government in this country and of democratic values in the region as a whole.

But even some U.S. military officials who know him and like him suggest that he and other members of the Honduran high command could overcommit their forces in the fight against Nicaragua and should not be allowed to force the commitment of U.S. troops.

As one military officer visiting this capital said recently, "I'm not sure you want to tell the Hondurans you're going to back them 100 percent." Some of them, the officer said, "do have delusions of grandeur," some "do think they could take them," referring to the Sandinistas.

In a lengthy interview last night, Alvarez showed both his potential for military moderation and his fierce ideological opposition to communist influence in the region.

"Everything you do to destroy a Marxist regime is moral," Alvarez said as he concluded his conversation with reporters.

The general called the Nicaraguan "counterrevolutionaries" fighting the Managua government "the cheapest and most just" means of resolving Central America's crisis.

Alvarez suggested, however, that the best way to see the Sandinistas removed from power would be through elections.

The general has long-standing personal ties with at least one of the top leaders of the Nicaraguan anti-Sandinista rebels. Former Nicaraguan National Guard major Emilio Echaverri, now the chief of staff of the Nicaraguan Democratic Force, was a classmate of Alvarez at the national military academy of Argentina in the late 1950s. Although Alvarez consistently has denied that Honduras gives direct support to the anti-Sandinista rebels, he said last night that the U.S. Congress should do so.

"While a Marxist government exists in Nicaragua problems are going to continue," Alvarez said. The rebels "are the cheapest solution we have."

Alvarez said the negotiations that other Latin American nations are trying to further under the auspices of the four-nation Contadora group could be effective in bringing about what he considers to be necessary changes in the Nicaraguan government.

But, he added, "I asked myself when a negotiation with the communists has been to the advantage of the West."

Alvarez took as an example the Paris peace talks with Vietnam conducted by Henry A. Kissinger, suggesting that the former secretary of state essentially gave away all of Southeast Asia.

"Is that negotiation?" asked Alvarez. "That is not negotiation."

Asked how he felt about Kissinger's appointment as head of a new bipartisan commission on Central American policy, Alvarez said, "I hope for the good of Central America that this is his lucky moment."

Alvarez said that the Sandinistas and Salvadoran rebels are only willing to negotiate now because they are "losing."

"When communists are winning they say, 'Victory or death,' " Alvarez commented. "When they are losing they say they will negotiate."

But the general said that under the present circumstances, "I am very optimistic. We are going to win the battle against communism." He added that current actions "are guaranteeing that Central America is going to be part of the West."

The greatest worry of Honduras in the four years since the Sandinistas took power in Nicaragua, Alvarez said, has been the fear of domestic subversion inspired by Nicaragua.

He added that he does not believe the Sandinistas want to make war openly on his country under any circumstances, but prefer instead to use what he called "dirty and cowardly" tactics.

During an interview yesterday evening and earlier during a visit to a new U.S.-funded training facility at Puerto Castilla, Alvarez said the Reagan administration's public commitment to the fight against communist expansion in the hemisphere has helped dispel his government's worries about covert and overt operations against it.

In the company of the chairman of the U.S. Joint Chiefs of Staff, Gen. John W. Vessey Jr., and Salvadoran Defense Minister Gen. Carlos Eugenio Vides Casanova, both visiting for the day, Alvarez watched Honduran and Salvadoran troops blasting targets, crawling up hills and vaulting obstacles under the supervision of more than 100 U.S. Special Forces trainers.

Today more than 87 additional U.S. advisers arrived in the capital to start planning the massive joint maneuvers scheduled here in coming months. The first of these operations, according to U.S. military officials, will take place in the province of Choluteca, which borders on Nicaragua.

The maneuver will be designed to show the Hondurans how to defend themselves if the Nicaraguans were to send any of their Soviet tanks across the frontier.

Both Alvarez and the U.S. officers here make the point that the Honduran Army, which has fewer than 20,000 men, could not withstand an all-out fight against Nicaraguan regular forces and reserves--totaling almost double that figure--for more than a week without major outside assistance.

Alvarez said yesterday that he would not rule out the possibility of asking for a direct U.S. commitment of combat troops "if there were no other solution."

"But if they give us military assistance at the opportune moment and in sufficient quantities we have the ability to defend our own country," he said.

Asked if he has had any assurances that a request for combat troops would be granted by the Reagan administration, Alvarez said, "They have not given us a definitive answer."