Nearly 3 million voters began their trek to the polls today as Africa's youngest nation launched one of the continent's rarest political events: a free election with competing political parties.

Prime Minister Robert Mugabe's ruling party is strongly favored to retain a parliamentary majority following a three-week campaign marred by charges of intimidation and, in recent days, the resurfacing of racial animosity after the triumph of right-wing former prime minister Ian Smith in a special whites-only election last week.

Thousands of voters, some of whom had walked for four hours or more, peacefully formed huge lines this morning at polling places throughout the country. They brought food and blankets to ward off the chill and many said they were prepared to spend the night if necessary to cast their ballots.

Although the early voting was hampered by confusion and delays, there was little evidence of harassment. To accommodate the large turnout, election officials announced that the balloting, which was scheduled to take two days, will be extended until Thursday after requests from all the major parties.

The size of Mugabe's victory margin is critical in Zimbabwe's first full balloting since the country became independent five years ago. He hopes to convert a landslide triumph into a mandate to move Zimbabwe toward a socialist-oriented one-party state.

Mugabe concluded the campaign yesterday before a wildly cheering crowd of 100,000 supporters in a Harare suburb with a strong plea for national unity and a bitter denunciation of Smith's unexpectedly large electoral triumph.

Mugabe said the results, in which Smith's party took 15 of the 20 parliamentary seats reserved for whites, showed that "the whites are still by and large the racists of the past. They have not changed in any way. It's going to be very hard going for the racists of this country."

The prime minister also denounced as a "dirty piece of paper" the constitution negotiated in 1979 that gave whites control of 20 of Zimbabwe's 100 parliamentary seats though they comprise less than 2 percent of the population.

"What the constitution tells us is that the white man of this country is 20 times as great as the African," he said. "I can assure you we will not live with that indignity and insult for very much longer."

Mugabe's stinging words climaxed a campaign that otherwise has generally been low-key and one-sided. It has reflected the dominance of the ruling party and the apparent inability of Mugabe's two main black political foes, opposition leader Joshua Nkomo and former prime minister Abel Muzorewa, to forge an effective appeal to voters beyond their limited regional bases.

There have been scattered reports of harassment of opposition politicians during the campaign, and claims by Nkomo and Muzorewa that the government intends to rig the vote. But there was little of the mob violence that plagued the central Midlands region and Nkomo's political stronghold of Matabeleland during the past year.

In a television interview yesterday, Mugabe confidently predicted that he would win between 65 and 70 seats and greatly improve his party's showing in the 1980 preindependence election, when it won nearly 63 percent of the vote and 57 of the 80 black seats. But his rivals hope to capitalize on lingering popular discontent to stage an upset. Nkomo won 20 seats in 1980, Muzorewa, three.

The area of strongest opposition is likely to be Matabeleland, where there are 15 seats and where Army counterinsurgency operations against armed dissidents have resulted in hundreds of civilian deaths over the past three years. Nkomo also hopes to hold onto his four seats in the neighboring Midlands, considered a swing province. The two regions contain most of the country's Ndebele-speaking minority, which is Nkomo's base of support.

The election comes at an optimal economic moment for Mugabe's nonaligned government. After three tough years of drought and recession, Zimbabwe's economy is growing, its fields are set for a record grain harvest and the mood here is cautiously optimistic.

These achievements have been accompanied by a general muting of the government's Marxist rhetoric. Mugabe is still dedicated to what he calls "scientific socialism," but his campaign speeches sounded more like the New Deal than "Das Kapital," emphasizing the government's achievements in building schools, housing, clinics and roads as well as in tripling public school enrollments.

Mugabe has enjoyed all the advantages that five years of incumbency can offer, including a full campaign chest supplied by businessmen eager to back the winner and worshipful coverage from the state-run broadcast media and most of the semiofficial daily press. Media officials had promised "fair access" to Mugabe's opponents, but their speeches and campaigns have received limited, intermittent exposure, far overshadowed by government attacks on their policies and leaders and by gleeful coverage of defections from their ranks.

A nagging worry for Mugabe's party is lingering dissatisfaction among city dwellers. Food prices have more than doubled since independence, indicating that while farmers are prospering, city residents are footing some of the bill.

Muzorewa and Nkomo have attempted to appeal to city voters with little apparent success, in part because they are competing with each other as well as with Mugabe.

To counter urban discontent, the government is resorting to the old-fashioned pork barrel. Mugabe has toured the country promising new housing and public works projects. Labor Minister Frederick Shava recently announced wage increases as high as 15 percent. They take effect today -- the opening day of the election.