For the first time in more than 40 years, Poland held official celebrations today marking the anniversary of the country having regained independence after World War I.

Until now, Poland's communist government had refused to commemorate Nov. 11 as the traditional independence day since it was associated with the rule of Marshal Jozef Pilsudski, the hero of the 1918-20 war against the Soviet Union. The change of heart reflects the shifts that have taken place here over the past year and new attempts by the authorities to build a national consensus.

The official celebrations also appeared to be an attempt to divert attention from the anti-Soviet character of unofficial marches in Warsaw and other Polish cities.

Two years ago, right-wing nationalist groups organized a huge torchlight procession through the streets of Warsaw. Several prominent dissidents were arrested and the event was seen as a challenge to the government then headed by Edward Gierek.

Last year, following the birth of the independent union federation Solidarity, smaller but still illegal demonstrations were held.

Today's celebrations were given an official stamp of approval with formal wreath-laying ceremonies and articles in the press. Red-and-white Polish flags were hung from public buildings throughout the country.

Later, big crowds marched through Warsaw from the old royal castle to the tomb of the unknown soldier, who was killed fighting the Russians. Leaflets handed to the crowd recalled the history of Poland's threefold partition among Russia, Prussia, and Austria during the late 18th and 19th centuries and its reestablishment as an independent nation in November 1918.

The celebrations also marked a partial rehabilitation of Pilsudski, whose name has long been anathema to communist officials. An exhibition devoted to his career has opened in the southern town of Krakow and a shipyard in Gdansk (not the Lenin Shipyard) also has been named after him.

The sudden rediscovery of prewar national holidays has helped create a bewildering plethora of anniversaries here. They range from communist events such as the Bolshevik Revolution in Soviet Russia to Christian festivals such as Easter and the anniversaries of postwar workers' upheavals here in 1956, 1970, 1976 and 1980.

Meanwhile, Solidarity leader Lech Walesa said he hoped to hold another meeting soon with the premier, Gen. Wojciech Jaruzelski, and the Roman Catholic primate, Archbishop Jozef Glemp. He told workers in Krakow that he expected relations with the communist authorities to improve following last week's summit, which he described as only "an initial contact." The Communist Party's decision-making Politburo also has called for more talks between the government and Solidarity, but no date is set.

Despite the National Assembly's appeal for an end to strikes, scattered unrest continues in several parts of the country. In the western city of Zielona Gora, 150,000 workers have begun the fourth week of a general strike to press demands for the removal of an allegedly incompetent director of a state farm and other local officials.

East of Warsaw, at Siedlce, farmers have been occupying the offices of a youth organization to demand the passing of a law guaranteeing permanent land ownership. The protest now has received the formal backing of the rural branch of Solidarity, which has called on farmers elsewhere to send representatives to Siedlce to join the sit-in.

Talking to workers, Walesa repeated earlier calls for an end to all uncoordinated local strikes, which he said undermined the strength of the union.