Thousands of shipyard workers staged an eight-hour strike here today to protest the dissolution by parliament last week of the Solidarity independent trade union.

The strike was followed by four hours of street fighting as special police armed with tear gas and water cannons attempted to disperse workers and Solidarity supporters who had gathered outside the gates of the giant Lenin Shipyard.

Police roadblocks were set up around the city and many motorists were turned away.

Meanwhile, the official news agency PAP announced the release of 308 people interned under martial- law regulations, fulfilling a pledge by military ruler Gen. Wojciech Jaruzelski last Saturday that a substantial number of those held, estimated to total more than 800, would be freed.

The strike in Gdansk, the biggest the Baltic Coast city has seen since the early days of martial law, marked a significant change of tactics by the union. Until now most protests against the martial-law government here have taken the form of short, symbolic strikes or mass street demonstrations.

The city, the birthplace of Solidarity, was quiet by this evening, but many workers insisted that they would stage a similar strike Tuesday.

Telephone and telex links with Gdansk were cut soon after the strike began at 6 a.m. when the first shift reported for work at the shipyard.

Workers said that rather than wait for riot police to storm the factories, they would leave at the end of the shift and return every day.

Today's strikes began after leaflets were distributed in Gdansk signed by underground Solidarity leaders, calling on workers to defend the union. A worker at the Lenin Shipyard said that the protest there erupted shortly after the start of the first shift.

The strikers at the Lenin Shipyard were joined by workers in the neighboring repair-shop yard and the northern shipyard. Workers in several smaller enterprises also joined in as did other workers at the Paris Commune shipyard in nearby Gdynia.

The gates of the Lenin Shipyard, from which Lech Walesa addressed the striking workers in August 1980, were once again festooned with flowers, Solidarity banners and portraits of Pope John Paul II. Slogans pasted to the wall of the shipyard read, "Solidarity is still alive," and "We won't let Solidarity die."

The shipyard workers spent the morning sitting idly by their machinery and along the walls of the plant. One worker said that the electricity in the plant had been disconnected by the strikers.

The manager of the shipyard and the military commissar pleaded unsuccessfully with the strikers to go back to work. At one point, the manager warned the workers that the shipyard might be closed entirely if the strikes are repeated.

Workers and other witnesses described the strike as an eruption of protest against the outlawing of Solidarity. There were few specific demands put by the strikers, but one worker said they were insisting on the release of Walesa.

He said that they demanded that the 37-year-old Solidarity leader, who has been held in isolation since the military takeover, be brought to the shipyards.

"Everybody is very angry and determined. Solidarity's dissolution proves that the regime cannot be trusted," one shipyard worker said.

The shipyard workers streamed out of the gates at 2 p.m., at the end of the first shift. Government television showed pictures of people working at the plant after the first shift ended.

The workers held an impromptu rally beneath the soaring monument of three crosses that was erected to commemorate those killed in the food riots in December 1970 together with workers from other parts of Gdansk.

A crowd estimated at up to 15,000 chanted slogans such as, "We demand Solidarity back," and "No union without Walesa." They also sang patriotic songs.

After about two hours, the remnants of the crowd were attacked by police using tear gas and water cannons. The crowd dispersed into smaller groups, and isolated street fighting continued for the next three hours.

Polish television reported briefly on the strikes, but attempted to play them down, saying only that groups of youths had been dispersed by riot police from near the main railway station.

Police roadblocks were set up around Gdansk, but some were removed this evening. To file this dispatch, I had to travel 60 miles in the direction of Warsaw to find a phone that worked.

Communications were also cut with the port of Szczecin, suggesting similar protests had taken place there. Szczecin, along with Gdansk, was one of the areas of unrest in August 1980 that gave birth to Solidarity.

Gdansk radio, meanwhile, carried extensive accounts of moves to set up new trade unions encouraged by the Communist Party.

Most workers interviewed in Gdansk said they would ignore the new unions.