As cordons of heavily armed police were directing crowds of people out of Warsaw's Old Town last night, a group of men who witnesses said resembled plainclothed security agents broke into a nearby convent and beat up several young laymen involved in a church aid program for victims of Poland's martial-law.

A witness at the convent of Franciscan nuns said the attackers, numbering between 15 and 20 and "looking as if they had been trained in judo or karate," forced their way through a back door of the building just after a mass at St. John's Cathedral, a block away.

At the time 5,000 to 10,000 people were streaming out of the Old Town past a heavy police presence and onto a main road, in a peaceful march marking Poland's Constitution Day. Their march toward the city center soon was forcibly dispersed.

The witnesses said one of the assailants carried a walkie-talkie. A number of the plainclothed police agents in the Old Town yesterday and Sunday, when a pro-Solidarity rally was held, also had radio sets.

The Servants of the Cross Convent is attached to St. Martin's Church. It is a main clearing point for church aid to those considered victims of Polish political oppression, having been chosen at the time martial law was declared in December 1981 as the headquarters of the Roman Catholic primate's council for help to persons who were interned and other victims of military rule.

Poland's Communist authorities and Catholic Church officials have worked exceptionally closely in recent weeks to prepare for Pope John Paul II's June visit to Poland. But deep strains in the church-state relationship have continued, marked by the church's insistent appeal for a general amnesty for martial law violators and the government's great irritation over the fact that church masses were rallying points for May Day pro-Solidarity demonstrations.

According to a convent witness, the intruders used the handle of a garden shovel they picked up in the yard outside, as well as pieces of furniture, to beat about eight of the laymen working in the aid center. None of the nuns nor the convent rector was injured, but they were pushed aside when they attempted to stop the attackers.

Four men serving in the aid center were dragged out of the building and into a truck transport similar to those used by security forces, the witness said. They were driven to a wooded area on Warsaw's outskirts and released.

To get out of the Old Town area, the truck had to maneuver past streets lined with water cannon and dozens of police vehicles. Hundreds of helmeted police holding batons and riot shields were posted throughout the neighborhood at the time.

Spokesmen at the government press office and the Interior Ministry said today that they knew nothing of the incident. A church source said a report was being prepared, and senior Roman Catholic officials were told of the assault during a meeting of the bishops' conference today in Czestochowa.

Members of the convent as well as volunteers at the aid center were reluctant to discuss the incident