German unification is expected to cost West Germany untold billions of dollars as it struggles to absorb the crumbling East German economy.

But West Germany also stands to reap a mini-real estate bonanza, taking over scores of buildings and ambassadors' residences worldwide that belonged to the defunct German Democratic Republic.

In the Washington area, that includes some prime property in Maryland and Virginia that could be worth as much as $5 million, depending on the vagaries of the slumping real estate market, according to West German officials.

The largest piece is an eight-story, 28-unit apartment building on South Arlington Ridge Road near the Pentagon. Once known as Windsor Park Tower, the building was the target of a bitter -- and ultimately losing -- battle by Arlington County to collect real estate taxes in the late 1970s. The East Germans bought the building for $1.6 million in 1976 to house diplomatic staff and their families. The building had been completed in 1975 but had never been lived in. It came with wall-to-wall carpeting, enclosed parking, a swimming pool and recreation rooms.

The second prized property is the former East German ambassador's residence on Rossdhu Court in Bethesda just off Rock Creek Parkway that was officially valued in 1987 at $581,000. The East German ambassador left a few months ago, German officials said.

There are some costs to be deducted, German officials say. The German government, which has pledged to assume all the financial obligations of the East German government, will have to pick up a $27,000-a-month rent tab for office space on the former chancery on Massachusetts Avenue NW for the remainder of the lease, which expires December 1991, according to Sylvan Marshall, an attorney who represented the East Germans.

But the Federal Republic of Germany is going to give up one of the biggest prizes -- a two-thirds-acre lot off Connecticut Avenue NW near Van Ness Street. The East Germans, for a token $1, obtained a 99-year-lease on Lot No. 5 in the international office building compound there between the embassies of Qatar and Jordan. They had intended to build an $8 million chancery.

Last December, despite the crumbling of the Berlin Wall, East German officials said they were confident they would be around for a long time. "Our official position is that reunification is not on the agenda," said East German Embassy press attache Frank Mader. "That is all for the future . . . a lot of talk."

But now that the talk has become reality, German Embassy spokesman Hans-Henning Horstmann said, there is no need for the building. It may be a valuable lease, but the question, he said, is, "Do we need more space? We don't."

The German Embassy staff of 173 could increase slightly, he said, to meet the increased demands in the legal and consular department -- if the German parliament approves a request for extra help.

Most of the former East German employees have left. On Tuesday, East German officials handed over the keys to the various properties.

And Mader, one source said, is now working for an American company in the former East Germany.