Soviet Foreign Minister Andrei Gromyko is to visit Poland early next month before a crucial congress of the Polish Communist Party, it was announced today.

The announcement of Gromyko's visit, which follows mounting public pressure by the Kremlin on the Warsaw leadership, came as the Polish Communist Party wound up a month-long election campaign for the congress. It also coincided with ceremonies in the western city of Poznan marking bloody riots there 25 years ago, the first major disturbances against Poland's communist rulers.

Gromyko, a senior member of the decision-making Soviet Politburo, last visited Warsaw in October for a routine meeting of foreign ministers of the Warsaw Pact military alliance. His visit this time, however, is likely to be more significant in view of preparations for the congress and heightened Soviet concern about reformist trends in Poland.

The Kremlin has already conveyed its alarm to the Polish leadership about developments here in a series of meetings and messages climaxing in a letter to the Polish Communist Party Central Committee earlier this month. The letter touched off an unsuccessful attempt within the Polish Central Committee to unseat the party leader, Stanislaw Kania.

It was not immediately clear whether Gromyko's visit, which was announced by Tass in Moscow and on radio here, is designed to bring further pressure on the Polish leadership or is a sign that Moscow is prepared to allow the party congress to go ahead as planned. Despite earlier Soviet fears that they would be swept away, most of the hard-liners in the Polish Politburo have been elected as delegates to the congress and still have a chance of being reelected to the leadership.

In Poland, itself, attention has focused on a series of anniversaries commemorating past clashes between the workers and communist authorities. A quarter of a million people attended the unveiling of a large monument in Poznan today, a quarter of a century after 74 persons were killed in clashes between demonstrators and the security services.

An inscription on the monument read, "For freedom, justice and bread" -- the slogans chanted by striking workers as they marched from their factories to the city hall.

A remarkable feature of the Polish reform movement has been the attentive devoted to such victims of communism. In the last six months, a succession of anniversaries has been commemorated officially for the first time -- from the workers' demonstrations in Gdansk and other Baltic cities in December 1970 to the student upheavals of March 1968.

Last Friday was the fifth anniversary of the 1976 riots in Radom, when workers protested against sudden increases in food prices. Wednesday is the first anniversary of another ill-fated attempt to raise meat prices that started the upheavals of last summer.

Perhaps more than any other nation in Europe, Poles have been shaped by their collective memories: of previous rebellions against authoritarian government and foreign domination, of soaring hopes and of national tragedy.

The June 1956 events in Poznan set the pattern for a cycle of postwar crises. Soon afterward the nationalistically inclined Wladyslaw Gomulka came to power and promised to rectify the mistakes of his predecessors. But he lost touch with the people, and widespread disillusion with his rule set in.

This cycle repeated itself in 1970 when Gomulka was replaced by Edward Gierek. Then last year the workers insisted on institutional guarantees in the form of free trade unions.

Addressing the crowds in Poznan today, Solidarity leader Lech Walesa described events in the city 25 years ago as "our first lesson of the errors we had committed."

He added: "This time we shall not allow ourselves to be broken up, and we shall not allow anyone to seek antisocialist or counterrevolutionary forces from among our ranks. . . . The working people cannot be equated with counterrevolution."

In Poznan in 1956 and Gdansk in 1970, official attitudes toward the workers' disturbances went through similar contortions. First they were described as "counterrevolution" and "an imperialist plot," then as "a justified protest by the working class against the deformation of socialism."

Finally, as the party reasserted its control over the country, public discussion of the upheavels was suppressed and the leaders were gradually isolated. This time, largely due to Solidarity, the third phase has not occurred.

Another distinctive feature this time around is the widespread public discussion of previous crises. After being treated as virtually "off limits" for many years, the Poznan riots have become a subject of dozens of newspaper articles pamphlets, films, exhibitions, books and even television programs.

Recently Solidarity organized a photo exhibition in Warsaw devoted to unofficial pictures of the disturbances in 1956, 1968, 1970 and 1976. Pictures showed bodies crushed by tanks, buildings on fire and crowds of demonostrators in the streets.

Particularly revealing were comments scrawled by visitors on the way out: "We have hanged the pictures, now let's hang the murderers," "This exhibition is a proof that Poles will never submit to communism" and "Let freedom mean freedom and justice mean justice."

One comment, scrawled in a large, shaky hand, said: "Oh God, let it never repreat itself again. This time we must find a solution."