President Reagan, in an unusual diplomatic declaration, told the arriving ambassador from Nicaragua yesterday of U.S. concern about an "alarming military buildup" in that country and continuing Nicaraguan support for guerrillas in El Salvador.

Reagan also urged Nicaragua to "look anew at its situation and reassess the consequences of inviting alien influences and philosophies in the hemisphere."

Amid growing public debate about U.S. actions in Central America, Reagan took the occasion of a protocol call from the new Nicaraguan ambassador, Francisco Fiallos Navarro, to make blunt statements of his concern. The formal remarks at the White House ceremony were made public by the State Department.

Such exchanges usually are limited to pleasantries or professions of friendship. But Reagan, according to the published remarks, said:

"When we look at Nicaragua today, we see a continued involvement in the affairs of your neighbor, El Salvador; we see the hard work of your countrymen financing an alarming military buildup; we see the rights of your citizens, those in the private sector, the democratic political parties and labor unions, and especially the Miskito Indians of the East Coast, increasingly abridged."

The president also said that "the door to dialogue with the United States remains open; your government should take advantage of that fact."

Fiallos, according to the published account of his part of the exchange, said Nicaragua stretches out "its friendly hand" to the United States with the belief that "two different situations require different kinds of solutions to their particular problems."

Meanwhile, former attorney general Ramsey Clark, head of a private fact-finding mission just back from Nicaragua, said it is "absolutely absurd" to suggest that Nicaragua could be a significant military threat to its Central American neighbors.

Speaking in a series of meetings with reporters, Clark said the Reagan administration's hostility inevitably will drive Nicaraguans into the arms of Cuba and the Soviet Union.

"They say they get no respect from the U.S. government. All they hear is threats and abuse, but they won't give up" in seeking friendly relations, according to Clark, often a spokesman for liberal causes.

Two members of Clark's group, Roger Wilkins and Andrea Young, said they were the first outsiders permitted to visit a resettlement camp in Nicaragua for about 1,800 Miskito Indians removed from their home area along the Nicaraguan border with Honduras.

Wilkins, saying he does not support such resettlement, also reported that the Nicaraguan government is "doing everything it can" to care for the inhabitants. The Indian reaction, he said, is "quite mixed," with some Indians complaining that they were required to walk about 60 miles from their old homes to the new camps and were not permitted to bring possessions.

The Nicaraguan government, Wilkins said, justified the relocation on security grounds, because of raids in the area from exile groups across the border. The exiles are "stimulated by the CIA," he quoted officials as saying.

In a related matter, Sen. Patrick J. Leahy (D-Vt.), who returned yesterday from a study mission to El Salvador, said continued fighting there can end only in victory for the guerrillas.

Speaking on the CBS Morning News, Leahy said that the Salvadoran government will admit privately that "the army, as things stand now, cannot win." The government's hope, he said, is for "a massive increase in American military aid."

Defense Secretary Caspar W. Weinberger, speaking on NBC's Today program, said there is "considerable danger" that the Salvadoran government will fall without U.S. military and economic assistance.

For "a bastion of communism" to be created on the American mainland by a guerrilla victory in El Salvador "would make the defense of the United States infinitely more difficult," Weinberger said.