JOHANNESBURG -- The South African Communist Party, which held its first public rally Sunday after 40 years as an illegal organization, has nearly three-quarters of a century of unswerving opposition to racism to thank for its status as perhaps the only growing Communist Party in the world.

The party has grown enormously in popularity despite having operated out of sight for longer than most of those in Sunday's cheering crowd of 35,000 have been alive. A special Suppression of Communism Act outlawed it in 1950, silenced its members, banned its publications and made it a crime to write or say anything favorable about any of its objectives.

Yet more people attended Sunday's rally than were on the party's rolls when it was banned. While Communist parties elsewhere are either in decline or struggling to maintain their positions, the South African party could win a significant role in government if negotiations to draft a post-apartheid constitution go as the Communists and their allies, the African National Congress, hope.

While bucking the global trend, the South African party has not been immune from the crisis shaking the Communist world. In trying to break free of its own Stalinist past, it has opened the door to internal criticism.

The Communist Party was first established in South Africa 69 years ago. Its founding fathers were mostly British socialists who migrated here to work in the country's gold mines. They were later joined by East European Jews who fled the pogroms of the 1930s.

Layoffs in the mines and efforts by the mining companies to employ blacks at lower wages, led the Communists to join segregationist Afrikaner miners in launching a major strike in 1922 under a startling banner: "Workers of the World Unite for a White South Africa!"

The strike failed and the Communists quickly recovered from this brief alliance with white separatists to turn their attention to mobilizing black workers. They helped blacks form labor unions for the first time in the 1920s, opened night schools for uneducated blacks and became the first political party to admit blacks as members, 30 years before author Alan Paton's Liberal Party. As party leader Joe Slovo noted at Sunday's rally, "We were the first party in South Africa to advocate majority rule."

Blacks responded with gratitude that has persisted to this day. Some analysts believe the early identification of white Communists with the black cause was a major reason that mainstream black nationalism in South Africa never has developed a racist character. Instead, the ANC, for example, proclaims a policy of "non-racialism."

Meanwhile, the gross imbalances in the South African economy -- which, according to a recent study sponsored by the Carnegie Corporation, had the world's widest measured gap between rich and poor -- reflected negatively on the capitalist system, to communism's advantage.

Black politicians and labor leaders saw the combination of low wages and the strict regulation of black laborers' mobility as evidence that capitalism and apartheid were in an exploitative partnership that came to be called "racial capitalism." Communism, as capitalism's antithesis, appeared to many blacks to be the natural alternative to exploitation.

Perhaps the main factor that built the Communist Party's popularity in the black community was the party's persecution by the government. As Slovo put it Sunday: "The more the apartheid government denounced us as public enemy number one, the more the black people of this country decided we must be public friend number one."

The alliance forged between the ANC and the Communist Party after both were outlawed enhanced the Communists' image.

But while its multiracial appeal helped the South African Communists escape the fate of Communist parties elsewhere, they could not avoid difficulties arising from upheaval in what was once the Communist bloc.

Since becoming party general secretary in 1986, Slovo has tried to adjust the party to the ideological revolution initiated by Soviet leader Mikhail Gorbachev. It was a task made more urgent by the prospect of legally participating in South African politics after President Frederik W. de Klerk lifted the ban on the Communist Party, together with the ANC and other black political movements, in February. The party's leaders realized it would have to shed its old Stalinist face or risk hindering the ANC's ability to win the trust of whites.

More importantly, they realized the party would have to become more open and democratic if it was to overcome misgivings in the black labor unions and make itself acceptable as the political vehicle of the working class -- its long-term goal.

Early this year Slovo released a 27-page essay attacking the authoritarianism of old-style communism, but partly excusing the South African party's past Stalinist practices. If communism divorced itself from authoritarianism and functioned within a democratic environment, Slovo argued, it was still a viable political system with "humanitarian goals superior to those of capitalism."

Rejecting a one-party state as incompatible with democracy and urging abandonment of the principle of "the dictatorship of the proletariat," Slovo called on his party to accept what he called "democratic socialism."

Slovo's glasnost has eased some of the misgivings, but, as in the Soviet Union, several socialists have publicly criticized Slovo for not going far enough.

In April, Faried Essack, a Moslem socialist, accused the party of authoritarian practices, which he said had not been adequately admitted or renounced in Slovo's essay.

"We run the risk of a return to non-democratic practices or totalitarian visions of a new South Africa if the break with our own past is not decisive," Essack said.