Namibian guerrilla leader Sam Nujoma is a man accustomed to moving on a two-track course in his single-minded effort to gain independence from South Africa.

Usually he speaks the rhetoric of war, and sometimes offers to negotiate.

This weekend, however, Nujoma changed the routine somewhat.He escalated his attack on Presidnet Reagan, calling him a "racist," but also offered concessions that could help the United States persuade South Africa to move toward a settlement in Namibia -- the site of Africa's most protected independence struggle.

"I think Reagan is a racist," Nujoma said in an interview. It was a remark that "certainly won't be helpful" in the U.S. efforts to restart Namibian negotiations, a Western diplomat said.

Nujoma, leader of the South-West Africa People's Organization (SWAPO) complained that Reagan's policy is based on the theory that the South African-controlled territory has "strategic minerals that are vital for the economy of the West. . . Therefore, South Africa must be supported at all costs. So our people are suffering because of American economic interests."

That was Friday. Today he told a rally attended by 30,000 people, which capped a week of Zimbabwe-Namibia solidarity demonstrations, that "we are prepared to give guarantees and safeguards to all white settlers in Namibia."

This could be interpeted to mean that Nujoma, 52, was moving in the direction of providing constitutional guarantees to the 100,000 white-minority population, just as the Reagan administration has been proposing to help break a stalemate in the Namibian negotiations.

Washington would do this by having a constitution drawn up in advance of a cease-fire in the 14-year-old guerrilla war. The stalled, Western-devised U.N. settlement plan calls for a cease-fire to be followed by election of an assembly to write a constitution leading to independence. South Africa has balked at the plan.

The reagan administration also wants a Namibia settlement linked to the withdrawl of the 18,000 Cuban troops in neighboring Angola, where most of SWAPO's forces are based.

It should be noted, however, that Nujoma also said: "We will not accept any other country, no matter how powerful, to draw up our constitution. That is the prerogative of the Namibian people and nobody else."

He also took another crack at Reagan at the rally and returned to his constant theme that SWAPO would, if necessary, fight for a century to gain the independence of the territory, twice the size of California with a population of 1 million.

His labeling of Reagan as a "racist" is an escalation in the polemics Nujoma has been carrying out since the United States last month led the West in vetoing a U.N. effort to impose economic sanctions on South Africa because of its refusal to grant Namibia independence.

The charge is symptomatic of Africa's growing disagreement with the Reagan administration as it moves closer to Pretoria.

Zimababwe has been among the more moderate critics, but last week Foreign Minister Witness Mangwende said "America is displaying amazing insensitivity" to the feelings of Africans as it seeks to satisfy South African demands on Namibia.

On balance, however, Nujoma whom the South Africans regard as a Marxist terrorist, seems to be mellowing somewhat. Prime Minister Robert Mugabe, so far the master of black-white reconciliation in Zimbabwe, has most likely had a moderating effect on his guest in the last week.

White settlers, Nujoma said, were "welcome to live side by side with us in an independent Namibia like elsewhere in Africa."

"We are not saying the whites or the multinationals must get out," he added.

"We just say we want to have a share in running the state, and we want the majority to have the final say. The wealth of the country must be shared among the people."

It was almost vintage Mugabe, the self-professed Marxist who has learned to live, so far, with a capitalist economy run by whites.

The trouble is, a Western diplomat said, "Nujoma is no Mugabe," who earned five university degrees. The son of a peasant farmer, Nujoma's formal education was limited to primary school.

He worked on the railway and was a clerk before getting involved in politics and helping to found SWAPO in 1959. After a brief prision term he went into exile in 1960 and took Namibia's case to the United Nations.

Nujoma has been back in Windhoek, Namibia's capital, only once, in 1966. He was immediately arrested and deported the next day.

It is unlikely that he would get off so lightly today if he fell into the hands of the South Africans, who maintain that he is bent on implanting Soviet communism on their northern border.

Like Mugabe during Zimababwe's war years, Nujoma has had to get weapons in the communist world, mainly from the Soviet Union. This seems to be the basis of much of his Marxism.

"We never studied Marxism-Leninism," he said in the interview. "We met the Communists outside our country. They are friendly to us, therefore we are friendly to them.

"Certainly we are not going to be capitalists. . . . It is capitalists who are giving arms to South Africa to kill our people."

"Ideology is for America and the superpowers," he said. "Those of you who are already free, you have the privilege and time to study ideology. Our preoccupation is to free our people."

At the rally, Nujoma ridiculed Reagan's recent remark that South Africa stood by the United States in all wars. He referred to the pro-Nazi past of some South African leaders and said: "Apparently Reagan doesn't read the history of the world. He only knows about California."

Comrade Sam, as he is fondly called here, appreciates his own jokes and laughed and clapped along with the crowd. He also has the disconcerting habit of maintaining a toothy smile as he launches into the South Africans, saying they are guilty in Jamibia of "racism, fascism, inperialism and oppression."

Nujoma, who physically is not a figure likely to strike terror into the hearts of those who meet him, has spent the last 21 years in exile. SWAPO began guerrilla warfare against South African forces 14 years ago after Pretoria spurned U.N. demands for Namibian independence.

From most reports, SWAPO's struggle has not been going well lately. Nujoma is reluctant to discuss military matters or the number of guerrillas in Namibia. Most analysts think it is in the hundreds rather than the thousands with about 6,000 to 8,000 based in neighboring Angola where South African troops attack them almost daily.

South Africa has at least 20,000 troops in Namibia and does not appear to be hurting appreciably because of the war.

Nevertheless, the motto for Nujoma's visit here has been "victory is certain." He warned at the rally that if there is not negotiated settlement, "We will fight and make sure they [the whites] lose everything."