Prime Minister Pieter W. Botha, who has been losing support to right- and left-wing opponents since proposing a disputed constitutional reform plan last March, recovered some of the lost ground in five special elections yesterday.

Vote totals completed today show Botha's National Party inflicted reverses on two extreme right-wing parties, the Conservative and the Herstigte Nasionale, as well as the Progressive Federal Party -- the official parliamentary opposition which advocates racial integration instead of the current apartheid.

The rightists have opposed Botha's reform plan as going too far and endangering white rule, while the Progressives have opposed it as not going far enough. The plan would provide parliamentary representation, in separate chambers, for the mixed-race Colored and Asian minorities but not the voteless African majority.

Political analysts here are interpreting the results as meaning Botha has checked, though not reversed, the recent erosion of support from the National Party, which has ruled for 35 years.

Analysts regard this as especially significant on the right flank, where heavy defections to the Conservative Party had become a major worry for Botha and were thought to have caused him to backtrack on the negotiations for Namibia's independence, among other things.

Botha hailed the results as an endorsement of his reform plan. "Those Nationalists who were temporarily parted from their old and trusted party will do wisely to return now. Come back and play in the team," he said.

Nevertheless, only the fact that the two rightist parties failed to unite saved the Nationalist Party from losing one seat to them. It would have retained another by a skimpy 10 votes.

Comparison with a special election Aug. 18 shows what has happened. The Conservative Party was then only 5 months old, having broken from the Nationalists over Botha's plan.

In August, the Conservatives came within 308 votes of winning the safe government seat of Germiston District, near Johannesburg. Taken together with the Herstigte Nasionale Party, the rightists got 61 percent of the vote. It was this swift surge of support, and the prospect that it might continue, that alarmed Botha.

But this time the National Party won by margins of 506 and 1,602 votes in districts where its chances were reckoned to be slightly better than in Germiston. The combined rightists' share of the votes cast was 56 percent.

Although their growth has been checked, the rightist parties are still a potential threat if they can bury their differences.

The reverses of the Progressive Federal Party were likewise marginal, but significant in that they marked the first halt in a 10-year growth trend that has seen the party increase its representation from one--Helen Suzman--to 27.

Some voters appear to have responded to the government's charge that the Progressives's opposition to the Botha reforms is negative and obstructionist, that however inadequate the reforms may be considered, they are better than nothing and should be encouraged.