Accusing the Carter administration of conducting a "policy of blackmail against us," Cuban President Fidel Castro has underscored his country's determination to continue expansion of its military presence in Africa despite U.S. objections.

Castro's angry speech appears to be a response to a letter by 40 U.S. senators last week in which they urged him to curtail Cuba's military role in Africa as well as earlier messages by senior U.S. officals insisting that there could be no improvement in U.S. Cuban economic and diplomatic relations without such a curtailment.

Although he had expressed similar views to visiting U.S. officials and journalists, it was the first time that Castro discussed the issue on Cuban television. Analysts here suggested that the gradual process of Cuban-American rapprochement has been stalled on the issue of Cuba's military role in Africa.

Castro acknowledged that an improvement in U.S. Cuban economic relations "would be good for our country."

He said, however, that "it is not decisive. Our relations with the Soviet Union and the Socialist camp are decisive and the United States will never be able to substitute those relations."

Castro, speaking to the closing session of the National Assembly Saturday night, said Cuba "will never trade our ties with the Third World for a smile from the United States, for the smallest concession on their part. No material benefits will lead us to betray the confidence" of the Africans Cuba is currently helping.

American intelligence estimates on the Cuban troop buildup in Africa revealed last month that there were about 27,000 Cuban military and civilian personnel assisting leftist governments from Ethiopia in the north to Angola and Mozambique in the south.

Several hundred Cubans were reported to have arrived in Ethiopia in the past two weeks along with an influx to Soviet advisers seeking to shore up the leftist military government in Adais Ababa.

Castro asserted that Cuba would continue its assistance to Angola, Mozambique and Ethiopia as well as to leftist movements in Rhodesia, Namibia and South Africa. The Cuban presence is largest in Angola where 19,000 Cuban troops are helping the Marxist government of Agostino Neto battle rival nationalist groups.

Carter administration strategists had hoped that a measure of diplomatic rapprochement with Havana - after a 17-year-old complete break - would act as a restraining force on Castro's military adventures in Africa.

President Carter has been misled by his advisers in this respect, Castro suggested. "Perhaps the United States has the illusion that we are not able to live without relations" with Washington.

"We have responded with positive gestures to the positive gestures of the U.S. government," he continued, "But as long as the U.S. government bases its policy on blackmail against us by maintaining its immoral embargo, then the same way we fought against five presidents we will fight against a sixth".

Castro also indicated areas of disagreement in U.S.-Cuban contacts. Apart from the Cuban military role in Africa, Castro reaffirmed Cuba's support for the Puerto Rico independence as long as "there is one Puerto Rican that defends the idea of independence". He dismissed U.S. demands for compensation of U.S. companies whose properties in Cuba were confiscated by the Castro government.

On the question of indemnities, Castro said damage in Cuba as a result of U.S. sponsored sabotage and invasions and the economic embargo total $6.2 billion, well in excess of the total of $4 billion claimed by U.S. companies. He proposed that the mutual claims be cancelled.