President Carter wound up two days of talks with Brazilian officials here yesterday by reaffirming the United States' friendship with Brazil despite some sharp differences between the countries that were not resolved by his visit.

At a news conference yesterday morning and later in a speech to the Brazilian Congress in Brasilia, the president said that differences over human rights and nuclear non proliferation should not obscure the ties that bind the two countries together.

"On the long scale of things," he said at the news conference, "the major factors which bind us in harmony with Brazil far transcend [and] are much more important than the differences that have been published between our approach to human rights, for instance, and the subject of non-proliferation. But our commitment to Brazil as a friend, our need for Brazil as a partner and a friend, has always been the case and is presently very important to us and will always be that important in the future."

It was clear by the time Carter arrived here from Brasilia yesterday afternoon that the differences on the human rights and nuclear issues were not narrowed in his meetings with Brazilian President Ernesto Geisel.

But the president, by making no attempt to gloss over those differences while he was reaffirming U.S.-Brazilian ties, suggested that even issues on which he has placed great emphasis need not cause a rupture in overall relations.

The Brazilians clearly like the message. When Carter arrived in Brasilia Wednesday, he received a correct but somewhat chilly welcome from Geisel and other officials of the military government here.

By yesterday, however, the atmosphere seemed to have thawed somewhat even after Carter and Geisel had met without making any breakthrough on the human rights and non-proliferation issues.

The president was warmly received by the Brazilian Congress, where he struck the same theme he had employed earlier at the news conference.

"We share a common religion among many of our people, a common hope for peace," he said. "We share a feeling that our nations are bound together with unbreakable chains. We share a realization that when friendship is strong enough to sustain transient differences of opinion, that we can exchange ideas freely and without constraint, and in the process learn about one another and perhaps improve the attitudes of people in the United States and also Brazil."

He evoked a strong round of applause from the legislators when he mentioned human rights.

"We are learning together in the Western Hemisphere, which still has the vigor of newness, how we can exert our leadership throughout the rest of the world in dealing with hunger and despair, in dealing with the struggle for basic human rights," he said.

In many ways, Carter's visit to Brazil, his second stop on a week-long tour of four developing nations of Latin America and Africa, was an attempt to ease the strain in the United States' relations with Latin America's largest and most populous country.

The source of that strain goes back to the early days of the Carter administration and the president's emphasis on human rights and nuclear nonproliferation.

The military government that rules Brazil has been a prime target of international human rights organizations, which have charged the Geisel government with widespread abuses. When the United States last year criticized Brazil's human rights record, the government here abruptly canceled from military agreements with the United States.

The Carter administration has also sought to persuade Brazil to drop its plans to acquire a nuclear reprocessing plant from West Germany, arguing that such a plant would increase the risks of nuclear weapons spreading through the Third World. But Brazil, which lacks major coal and oil reserves, has refused to budge on the issue.

In a lengthy communique issue following the talks, the two presidents said they had agreed on "the importance of frequent and close cooperation" between their governments. In the past, Brazil has criticized the Carter administration for failing to consult with it often enough.

The president flew to Rio de Janeiro yesterday afternoon for what was planned as an evening of relaxation. He spent part of the night on a boat off the coast said to be owned by a Brazilian real estate developer.

Today Carter and his party are to fly to Nigeria to begin the African part of his third World tour.