Quebec separatist leader Rene Levesque has suffered his worst electoral setback since coming to power three years ago, raising hopes in the rest of Canada that his sovereignty drive for the French-speaking province may be running out of steam.

The defeat of Levesque's Parti Quebecois in three provincial by elections Wednesday will have little impact on the separatists' legislative position since they enjoy an overwhelming majority in the Quebec assembly.

Neverthelesss, the scope of the defeat confounded all predictions. Moreover, it came just two weeks after Levesque formally opened his campaign for a sovereignty referendum next spring.

In Ottawa Thursday, Prime Minister Joe Clark added his enthusiastic comments to those from politicians and newspapers across Canada by saying Wednesday's by-elections represented a "victory for federalistic forces" in Quebec.

The Parti Quebecois held two of the three seats. The third seat was left vacant when Fabien Roy went to Ottawa to become leader of the small Social Credit Party. Quebec's Liberal Party, which opposes Levesque's aim to make Quebec an independent state, won all three seats Wednesday. From its establishment in 1967 until now the separatist party kept gaining more and more adherents. It won 23 percent of the popular vote in 1970; 31 percent in 1973; and 41 percent in 1976. The prevalent assumption in Quebec was that Parti Quebecois was gaining ground with each election and that it never lost votes it had acquired.

The party suffered defeats in two by-elections last May, but it was fielding candidates in districts where it had little support.

This time, however, the separatists lost in two districts they had taken previously by impressive margins. The seat in the east-end Montreal working district, which was the stronghold of the separatists and which their candidate won by 62 percent in 1976, this week went to the Liberal candidate by nearly the same margin.

Diplomatic sources said the Parti Quebecois losses may be due, at least in part to recent serious labor trouble in Quebec, including a long strike of Montreal transit workers and a threatened walkout by public employees.

Levesque and his aides were quoted yesterday as saying that the three by-elections were fought over local issues rather than the party's aim to make Quebec a sovereign state while retaining close economic association with the rest of Canada.

Levesque said that "it would be profoundly dishonest to say that it has anything to do with the referendum" next spring on Quebec sovereignty.

But party insiders privately conceded that they were worried about the possible impact the electoral defeats may have on the morale of party activists. The more so since in Quebec, unlike the rest of Canada, by-elections have traditionally favored the party in power.

The Liberals, who are led by former editor Claude Ryan, insisted that "separatism" was the issue before the voters Wednesday. Like Levesque, Ryan insists that the status quo in Quebec is unacceptable to the French-speaking majority. Unlike Levesque, however, Ryan maintains that constitutional changes can assuage Quebec's grievances.