The puritanical white Afrikaners who rule South Africa are trying to secure their national survival by means of a political system that is heavily dependent on gambling and pornography.

Officially, it is a bluestocking country. The influence of the sternly Calvinist Dutch Reformed Church is pervasive. Its powerful Morals Committee once declared children's board games played with dice to be sinful.

A government censorship board scrutinizes every imported or locally produced book, magazine, film and stage show, cutting and banning all traces of lasciviousness. All gambling except horse racing is out. Public bars are closed on Sundays--and to women.

Yet 150 miles from Johannesburg is one of the world's most extravagant fleshpots: Sun City, a mini Las Vegas where roulette wheels spin and visitors can enjoy girlie shows and pornographic movies.

The paradox results from the government's policy of granting nominal independence to tribal "homelands." Sun City is in the "homeland" of Bophuthatswana and therefore officially outside South Africa.

The policy seeks to ensure the national survival of the outnumbered white Afrikaner volk, the Dutch-descended settlers who constitute 60 percent of the 4 million whites ruling 21 million blacks in this strictly segregated country.

It is supposed to make the future safe for them by turning the Africans, tribe by tribe, into statutory foreigners as each of 10 tribal "homelands" is declared independent. Eventually the whites will become a legal majority.

One difficulty is that the tiny, fragmented and undeveloped "homelands," which together make up 13 percent of South Africa's land area, are hopelessly unviable economically.

To meet this it has become the pattern for each newly independent "homeland" to make a deal with one of the big hotel chains to open a casino and pleasure palace in its territory. For the "homeland," this provides its biggest economic enterprise and source of revenue as pleasure-starved white South Africans come flocking to indulge themselves.

There are seven casino resorts in South Africa and neighboring African territories. There are plans to build another four as more "homelands" become independent.

Big money is involved. Nigel Matthews, managing director of Holiday Inns, which runs four of the casinos, said in an interview that they account for 30 percent of his chain's undisclosed but considerable profits. Its newest casino resort, in the Transkei "homeland," is making a $1 million profit in its first year.

Sun City, which belongs to a rival hotel chain called Southern Suns, is the big one. It cost $85 million to build three years ago and is making a bundle, because it is only 2 1/2 hours' drive from South Africa's metropolitan heartland of Johannesburg, Pretoria and the gold-mining towns of the Witwatersrand.

Getting a casino closer than that is Matthews' ambition. He has the site, in the Kwandebele "homeland," only an hour from Johannesburg.

Matthews wants to build a $100 million casino and pleasure palace there to outdo Sun City. He already has a contract with the "homeland's" leader, Simon Skosana, promising Holiday Inns the casino rights if Kwandebele becomes independent.

All Matthews needs is for Skosana to ask for independence. If Skosana does so, many Africans would regard it as a betrayal of his 450,000 fellow Ndebele tribesmen, who would lose their South African citizenship and be turned into deportable aliens.

Kwandebele is the least viable of all the "homelands." It was created out of 16 farms bought by the government two years ago. Thousands of Ndebeles evicted from the cities under the "influx control" regulations that restrict the right of blacks to live in white areas have been dumped there in a dozen run-down resettlement camps. There is no work, a single town newly built as a capital and only one surfaced road.

Yet under the Pretoria government's policy Skosana, a former vegetable vendor with a primary school education, has only to ask for it and this rural slum will be declared an independent republic with himself as president. Then Holiday Inns will be able to build its casino.

Skosana has said he will do this within five years.

Matthews insists his company does not bribe or even lobby "homeland" leaders to ask for independence in order to get casino sites, although he admits the opportunity to do so is tempting. Even to persuade Skosana to bring Kwandebele's independence forward a year or two would save millions in lower building costs and earlier profits.

"That is not our style," Matthews said. "Of course we may be losers in the end because someone else may do it. Every carpetbagger in the world is trying to get that contract away from us."

There have been some strange goings-on over casino contracts. When Holiday Inns first built a hotel in Transkei just before independence, Matthews said, the company was left with the impression it would be "first in the queue" when the government granted casino rights.

But when the time came it found it was not quite first. The Transkei government had given the casino rights to a company called the Mzamba Development Corp. and Holiday Inns had to buy the rights from Mzamba for $500,000 before it could build its casino.

After the northern Transvaal "homeland" of Venda become independent in 1979, Jaap de Villiers, a boxing promoter, took President Patrick Mphephu, one of his Cabinet ministers and a senior Venda official on an expenses-paid holiday to the Indian Ocean island of Mauritius. Soon afterward, the Venda government granted one of de Villiers' companies casino rights.

In October it was revealed that Hennie van der Walt, deputy minister of land affairs and chairman of a commission that determines where "homeland" borders should be drawn, was part of a private group that called on the leaders of the Kangwane "homeland" in 1981 to discuss casino rights. After a flurry of initial denials, a commission of inquiry has been appointed to look into this.