Cuba is preparing for "the eventuality of a total war" in the face of the Reagan administration's increasing hostility, according to published statements by President Fidel Castro and interviews with other ranking Cuban officials.

As part of this preparation the Cuban militia is building toward a strength of 1 million, more than 10 percent of the island's population, according to the officials. Arms shipments are arriving in quantity from the Soviet Bloc. Reserves are being called up, possibly to increase the Cuban presence in Angola as well as reinforce domestic defenses.

Cuban officials said they are no longer sending arms to guerillas in El Salvador or elsewhere in the Carribean basin, but they to admit that Cuba previously sent guns to the Salvadoran rebels. Castro and others add, moreover, that they would feel a moral obligation to resume supplies to the rebels if there were means to do so. They suggested that the means no longer available was Nicaragua.

Events as far away as Poland and Africa have combined with U.S. rhetoric to spur the Cuban buildup. The government here does not forget President Reagan's suggestions during his campaign that a naval blockade might be used against Havana, and they take at face value the remarks of Secretary of State Alexander M. Haig Jr. and other administration officials.

"Haig has threatened us in every way possible. He has said that he now has ready all sorts of options. When one talks of all sorts of options and doesn't exclude the military, well then one includes the military," said Cuban Vice President Carlos Rafael Rodriguez. "Our preparation is not a preparation motivated by paranoia, by an excess of precautions, but is a demonstration that we are ready to confront any eventuality that presents itself."

The Cubans portray the possibility of Soviet intervention in Poland as an indirect but very real threat to themselves.

"High American authorities have said that if something happens in Poland the United States would feel free to act in other countries. The closest country is Cuba. For someone with understanding, few words suffice. We have this as one of the possibilities from which comes out mobilization for total war," said Rodriguez.

South Africa's recent invasion of Angola also had a profound effect on Cuba, which feels a strong emotional and ideological commitment to the Marxist government there.

Castro has accused the United States of backing the South African move against Angolan bases of the guerrillas fighting to oust the South Africans from neighboring Namibia. He pointed to America's "hideous veto" in the U.N. Security Council of a measure to condemn South Africa for the invasion. The Cubans have backed up their commitment to Angola with about 30,000 Cuban troops, and there may be more on the way.

According to one ranking Cuban official, if the South Africans had moved another 60 miles into Angola they would have run into the Cuban forces.

"There has been an agreement between the Angolan government and ours," the official said, "to put very clearly in evidence that our troops don't have the purpose of political interference in African problems. Our troops are there to defend the sovereignty and security of Angola."

Reports have circulated at low levels in Havana for several weeks that Cuba's reserves are being called up on a voluntary basis for the Angolan front.

High Cuban officials said there are always a certain number of reserves on call to replace those troops already there, but not necessarily to increase their strength. Beyond this statement the officials were reluctant to comment.

As an example, one official cited the Shaba affair in Zaire in 1978, when the Carter administration accused the Cubans of backing an insurgent invasion of Zaire's rich Katanga Province from Angola -- an accusation that some U.S. officials now say was misleading.

At that point, the Cuban official said, Cuba was reducing its troops in Angola, but the process was reversed after Carter's accusations. "This was one of the cases," said the official, "when the reserves were used not only to substitute but to replace what we had withdrawn....We stopped a process that could have been very positive if Mr. Carter had not done all that he did, accusing us, threatening us, threatening Angola. So we sent them. It was a very important moment in the process."

The example is interesting since the Angolans suggested last spring that they would send back all the Cuban troops stationed there since 1975 if negotiations for the independence of Namibia succeeded. The negotiations failed and last month South Africa raided Angola.

Communist supplies to Central American insurgents are the central issue in the Reagan administration's increasingly tense relations with Cuba. The shipments, most of which apparently took place last year, have provided the Reagan administration with a focus for its criticism of the Castro government and sparked the growing battle of words and pressures against Cuba. Haig repeatedly has said the United States may "go to the source, Cuba," to stop such shipments.

The Cubans say the Reagan administration is overstating its case. "Lies, lies and lies," Castro called the charges of current arms shipments and even Cuban advisers in El Salvador.

But Castro told several leaders of international delegations at a recent interparliamentary conference that Cuba sent unspecified quantities of arms to El Salvador in the past, and other Cuban officials supported this statement. Castro said publicly and other members of the government reiterated that supply routes to insurgents fighting the U.S.-backed government now are closed.

The U.S. administration alleges that Soviet arms shipments to Cuba, now at their highest level since 1962, according to Washington, are destined in part for Central American rebels. The State Department says more than 40,000 tons of Soviet arms have arrived here this year.

Cuban officials vehemently deny this. The Soviet arms are now and always have been for the purpose of defending Cuba itself, they say.

"We never sent arms we received from the Soviet Union," said Rodriguez.

One senior official added, "We have non-Soviet arms here in quantity. I don't say astronomic, but sufficient" to supply Central America.

The Cubans insist that past supply routes to the Salvadoran rebels are closed. They would not say what those routes were, but the implication is that Nicaragua, whose leftist government is in deep economic trouble and under considerable pressure from Washington, is no longer willing to risk being a base of supply.