Cuban President Fidel Castro has made an abrupt about-face from his harsh public attacks against President Carter two weeks ago, and he said tonight he has not come here to attack the United States but to speak about the economic problems of the Third World.

In an interview at the heavily guarded Cuban mission to the United Nations, Castro indicated that he has adopted the more conciliatory attitude displayed this week by Soviet President Leonid Brezhnev and that he considers the issue of Soviet troops in Cuba a closed book.

"I'm not interested in the quarrel between Cuba and the United States," Castro said. "I've had lots of opportunities to talk about that."

Instead, Castro said his speech to the U.N. General Assembly Friday morning will deal with the "essential economic conflict between the developed and underdeveloped world."

It is the Third World, Castro said in an assessment that is sure to be a theme of his speech and has caused much disagreement among developing countries, "that I represent."

The interview was the first Castro has given since his arrival on a Cuban airliner at John F. Kennedy Airport shortly after midnight this morning. His U.S. trips, Castro said tonight, will last "a minimum of five days and a maximum of 10. I'm not in a hurry."

Ironically, Castro arrived on his first visit to this country in 19 years at a moment when 1,500 U.S. Marines were loading onto troop carriers that will take them to Cuba for maneuvers.

The Marines' maneuvers at the U.S. naval base at Guantanamo are intended to display a combat readiness as part of Carter's answer to the 2,000 to 3,000 Soviet troops stationed in Cuba. Confirmation of their location led to a confrontation between the United States and the Soviet Union. The Soviets have reportedly refused to remove them.

"It's all a great comedy," Castro said of the U.S. military deployment.

"Cuba is calm and sure of itself. It would take many more than 1,500 Marines to invade Cuba, and the deaths would be many more than 1,500."

Castro said that Carter in his Oct.1 speech about the Soviet troops, "intended not to frighten Cuba, but to frighten the Caribbean, Central America and Latin America."

"His speech was forceful and imperialistic," Castro said, "and it provoked a great fear among the Caribbean countries." While he acknowledged U.S. State Department concern about a possible expansion of Cuban activity in the area, Castro maintained that "Cuba is no threat to anyone, but everyone is afraid of the United States."

"Political movement in the Caribbean is spontaneous," Castro said. "Their [the nations'] problems essentially are economic ones, and we are prepared to help economically as much as we can. We are not competing with the United States, we are competing with poverty and underdevelopment. We invite the United States to fight against them."

While Castro said Cuba's main efforts in the Caribbean are to "countries that are already organized; to constituted governments," he said it was Cuba's duty "sometimes" to help "liberation movements" in the region.

In Central America, the United States fears political unrest may provide Cuba with an opportunity for increased influence. Castro denied as "a lie, absolutely false" charges by some U.S. congressmen that Cuba has given arms or material aid to guerrillas in El Salvador. Asked if Cuba would help in the future, Castro said he "reserved" comment.

Asked if any Salvadoran guerrillas had received or were receiving training in Cuba, Castro said "I decline to respond to that."

In contrast to a heated press conference two weeks ago in the middle of the troop confrontation in which he called Carter "dishonest," Castro was soft-spoken and made few personal references to the U.S. president. While he said the United States still may be trying to overthrow his government, "but with less hope of success each time," Castro maintained that "Cuba is a hard bone to chew."

In a familiar move that was half public relations gesture, half dare, Castro said "I invite Carter to speak to the people of Cuba whenever he wants to. I offer all the radio and television stations, and the press. I think if Carter is right, he ought to convince the people of Cuba that their government should be overthrown and that Castro should be shot."

But throughout the hour-long interview, Castro said he had little interest in talking about Cuba or relations with the United States. He asked several times whether tonight's interview would be published before he gave his speech Friday. His main concern appeared to be preparing the ground for a speech that he clearly hoped would be received as one demonstrating Cuba's position as a Third World leader and Castro's leadership role within the movement of nonaligned countries.

Secluded inside the Cuban mission in midtown Manhattan, from which he did not emerge throughout the day, Castro received only two official guests today. Maurice Bishop, the new prime minister of the Caribbean island nation of Grenada, where Cuba has taken an active military and economic role, came to lunch. Castro said he also was visited by the General Assembly president, Salim A. Salim of Tanzania.

The rest of the day was spent polishing his 75-minute General Assembly speech which, he says, is "too long," but will make the movement of nonaligned nations happy.

As chairman of the 94-nation organization, Castro angered a number of delegations at last month's Havana summit by insisting that the Soviet Union reflected the movement's goals, while the United States remained its principal enemy. Some delegates charged Cuba with heavy-handed leadership designed to move the organization closer to the Soviet orbit.

Castro denied the existence of schisms within the movement, "Our relations are excellent," he said, " and after tomorrow" when Castro gives his speech, "they're going to be even better. I'm going to defend human rights and the Third World and underdeveloped countries."

The scene inside the Cuban mission, a modest building in a row of undistinguished structures, was markedly calm compared to the chaos that reigned without. Heavy with the smoke of strong Cuban cigarettes and cigars, the atmosphere was quiet, as Cuban officials and bodyguards moved bedding from room to room to accommodate the 200-man Castro entourage.

Castro's principal advisers are traveling with him, along with a number of personal body guards.

The New York City police and the Secret Service have detailed an estimated 2,000 officers to handle security for the Castro visit. Four blocks around the mission have been completely sealed, including part of Lexington Ave., a main thoroughfare. Residents of what police called the "frozen area" were required to have their names and addresses checked on a list before they could enter. All who walked the floodlit streets inside the barricaded area had to be accompanied by an individual police guard.

Throughout the afternoon, small groups of anti-Castro Cuban exiles tried to approach the area. At nightfall, a larger group gathered outside the barricades chanting "Fidel, go home." Immediately, several dozen riot-equipped policemen formed a human blockade.