Above the angry shouts of rioters and the crack of police rifles, most white South Africans hear the reassuring purr of factory machinery going full blast, the ping-ping-ping of computerized cash registers taking in record sales and the clank of building cranes work-overtime.

The South African economy is sailing through a record boom period. The prosperity offers whites some consolation for their political problems, and in official circles, there is even a bit of smug self-satisfaction that this is happening while Western countries critical of South Africa for its domestic policies are grinding through a recessionary period.

There is a feeling, as one political commentator put it, "that the polecat is having its day."

And it is quite a sunny day. The economy is expanding at an annual rate of 6 percent, the highest since 1974, and consumer spending was up 21 percent in the first quarter of this year.

New-car sales jumped 35 percent in July, and 1980 sales may top the quarter million mark for the first time. New hotels are in the works to cater to an expanding tourist trade.

"Whites have more money than they know how to spend," said one American banker.

Zooming gold prices are heavy sales in other minerals like platinum, uraninum and coal gave South Africa a current-accounts surplus of $3.7 billion last year. A brief peak price for gold of $800 an ounce early this year left the first quarter surplus reading a more than comfortable $2.5 billion.

"For a country of this size, that's unbelievable," said one Western economic analyst here.

The South African Foreign Trade Association reported that the country is now selling its products to 130 countries, more than ever in its history, and its 1980 midyear trade surplus registered $4.2 billion.

Among those harvesting the rewards of this booming economy are subsidiaries of more than 300 American companies who are making "historic highs in profits, up 49 percent here, 80 percent there," said one Western diplomat.

American trade with South Africa, which expanded in 1979, is following a similar trend this year. The value of American exports to South Africa rose 30 percent in 1979, and South African imports went up 16 percent.

But in this rosy economy situation, there are also problems which tend to make the boom appear like a hot-air balloon silently passing over the heads of most black workers.

The expansion has fueled South Africa's inflation rate, which is expected to go to 15 percent by the end of the year and perhaps as high as 18 percent next year.

Though this affects everyone, it is hitting the poorest hardest. A recent survey by a University of Witwatersrand professor found, for example, that the real wages of black workers in Johannesburg have dropped by 13 percent since January, 1977. This has contributed to the labor unrest that has plagued South Africa this year.

Secondly, more than 20 years of segregated schooling and restrictions on work opportunities have left the black population woefully behind in educational standards and skills that the booming economy is soaking up like a dry sponge. As a result, serious unemployment, ranging from official estimates of half a million to independent figures of between 1 million and 15 million, still exists among the mostly unskilled black labor force.

Unable to find enough skilled workers even among the whites, companies are turning to overseas recruiting.

In addition, Finance Minister Owen Horwood's tight fiscal policy, trying to keep down inflation, has funneled most of the gold bonanza into private enterprise through tax cuts and a tight rein on social welfare spending, whose benefits would go mostly to blacks.

The budget the Horwood presented last March did give tax cuts to blacks as well as whites and increased wages of blacks teachers and other civil servants. But it increased spending on black education by only 33 percent, leaving the total allocation still 40 percent below what is spent on education for the white minority.

Many observers were surprised that although allocation for black housing was doubled, it was nowhere near what was needed to meet the housing backlog.

Finally, the price of bread was increased and a general sales tax remained in force on basic foodstuffs.

"For blacks, the budget was a sow's ear in a silver purse." commented one Western observer.

"They had the money, but most of it went into tax cuts," observed another. "Having decided this philosophy was right, they put all their money back into private enterprise. It is sound conventional economics which in terms of any other country is okay, but this is not just any other country," he added.

Most economists expect the boom to taper off next year when the government moves to curb inflation, the skilled-labor shortage begins to hamper further growth and the delayed effects of the general world recession start to be felt in reduced purchases of South African minerals.

But even when the boom subsides, economic factors leave South Africa ideally poised for a period of tremendous economic development over the next 20 years. Government planners have announced ambitious blueprints for towns and industrial complexes. The private sector, already spurred by the present boom, has planned projects for the next three years that require $37 billion in investment capital. In mining alone, investment projects totaling more than $3 billion are under way or announced.

It is one of Prime Minister Pieter W. Botha's hopes that this economic expansion will ease the way for some pragmatic political changes. "They are banking on sheer momentum of the growth rate to defuse right-wing opposition, the idea being that if all whites have a job, they won't mind change so much," said one Western diplomat.

Apart from that, both government and private sector economists say a minimum annual growth rate of 5 percent will be necessary to cope with the country's projected population growth.

By the year 2000, South Africa's present 24 million inhabitants are expected to increase to 37 million, and an average of 1,000 new jobs must be created each workday to keep pace with the flood of job-seekers.

The government has just begun to address two of the most serious obstacles that will put a drag on this economic development -- a desperate shortage of skilled labor and an increasingly militant labor force at loggerheads with an officially sanctioned labor structure.

The remaining obstacle is the political situation. "As a developing country, we need a lot of foreign investment capital, and we would have this automatically if we could take away the political unrest," said one Afrikaner economist.

"South Africa will continue to be a good market and good place to invest,' said one American banker. "But I'm not sure we can count on the U.S. environment to let that happen."