BONN, OCT. 21 -- Suddenly this summer, on shopping streets in Bonn, in chic restaurants in Berlin, in department stores in Frankfurt, the Gypsies appeared.

Scrawny and often shoeless, Gypsy children tugged on the sleeves of proper German burghers and presented scraps of paper, pleas for money written in barely comprehensible pidgin German. Gypsy mothers and children staked out spots on busy downtown sidewalks, sat down and held out their palms.

The arrival of 20,000 to 40,000 Gypsies fleeing economic deprivation and political oppression in Romania and Yugoslavia shocked many Germans in this largely homogeneous country. The Gypsies were different, even from other Gypsies who have lived in West Germany for decades: The new ones seemed to live on the streets, were often dirty, intrusive and noisy. And they were obviously not German.

As the newly reunited Germany struggles with massive unemployment and economic need in the former East Germany, the country is wrestling anew with a problem that stirs painful memories: how to treat foreigners in a land that is anxious to refute its racist history but reluctant to see itself as multicultural.

The issue has arisen before. In the 1950s and '60s, West Germany recruited hundreds of thousands of Turkish workers to help rebuild the war-ravaged nation. When the labor shortage disappeared in the 1970s, Turks were offered financial incentives to go home.

Most did not -- in fact, 10 percent of the population of Berlin is now Turkish -- and those who have remained are still considered second-class citizens by many Germans. Even second- and third-generation Turkish Germans are not automatically granted German citizenship, a source of continuing unrest.

Germany also has 85,000 foreign guest workers who had been living in East Germany under contracts with Communist allies such as Yemen, Cuba, Vietnam and Mozambique. For weeks leading up to unification Oct. 3, the Bonn government promised that it would not push them out. Since unification, however, Germany is offering the foreign workers $2,000 each and a free flight home if they will leave the country and has sent thousands home on charter flights.

Gypsies (who find that name itself derogatory and prefer to call themselves the Romany people) are not new in Germany. In what was formerly West German territory, there are currently 60,000 Gypsy families who have been there since the 1950s or earlier. These people hold German passports, are well assimilated into society, and many are quite affluent.

The new Gypsies are entering Germany with Romanian and Yugoslav passports. Their arrival has presented a difficult challenge to Germany, which at once desires to be seen as an open democracy but also retain its identity as a country of "ethnic Germans," the phrase the government uses to describe descendants of people who were citizens of Germany before 1938.

The reaction in Germany to the influx of the Gypsies -- descendants of nomadic clans who have wandered through Europe since the Middle Ages -- has been blunt. The state of Saarland, for example, has rounded up several thousand newly arrived Gypsies and put them in an overcrowded camp surrounded by barbed wire.

In Berlin, according to several Gypsies interviewed at an encampment in a parking lot near the city ice-skating rink, so many newly arrived Gypsies have been kicked and beaten while they begged on downtown streets that they have resorted to picking through garbage for food.

"Even if we just stay here in our cars and vans, in a parking lot far from anyone's house, the Germans come here and yell at us and call us niggers," said Victor Dura, a Gypsy who said he brought his family to Germany to escape threatened pogroms in Romania. "We are only trying to make some money and leave here. I promise you, no Gypsy who is right in the head would want to stay in this country forever."

Herbert Heuss, secretary of Germany's Romany Union, charged that Germany is practicing "ghetto politics." "There is really an atmosphere of pogroms, in this camp in Saarland and all around Germany."

Heuss also charged that while Germany has announced its willingness to accept responsibility for the murder of 500,000 Gypsies in Nazi concentration camps, it is now refusing to accept its role as a wealthy nation on the edge of poverty-stricken Eastern Europe. "Germany is in fact a land of immigration," Heuss said. "This is not just a question of the Gypsies. This problem will only get worse."

About 400,000 refugees from Eastern Europe are expected to arrive in Western Europe this year -- more than half of them in Germany. But although the German constitution has long had one of the world's most liberal asylum laws -- a deliberate attempt to distinguish the postwar West German democracy from its Nazi predecessor -- the idea of non-Germans becoming part of the society has never caught on.

"We are just not a multiracial and multicultural society," Berlin Mayor Walter Momper, a Social Democrat known for his good relations with the city's Turks, said recently. "We are a really pure, good German society, with a German social and cultural heritage. Of course, we have 2 million foreigners {among the 61 million residents of the former West Germany}. But you cannot say it's a multicultural or multiracial society at all."

To Lothar Spaeth, governor of the German state of Baden-Wuerttemberg, "things are getting out of hand." Spaeth, a member of Chancellor Helmut Kohl's Christian Democratic Union, has proposed a constitutional amendment that would dramatically narrow Germany's right of asylum, slashing by 70 percent the number of refugees who could win permission to stay.

Amnesty International, the human rights monitoring group, said Spaeth's proposal "would leave countless politically persecuted people without protection."

But with the number of asylum-seekers mounting -- there were 24,000 in September -- and with national elections six weeks away, a political consensus is emerging to tighten the immigration rules.

Since World War II, Germany has guaranteed automatic citizenship to anyone who can show that he or she descends from German citizens. There is now a move afoot to narrow the definitions of what constitutes a German and a political refugee, making it harder for East Europeans to stay in Germany.