Washington Real Estate Investment Trust yesterday sold one of its prime apartment house properties in the District and purchased a downtown office building in a complicated three-way exchange that may have been prompted by the city's rent control law.

WRIT, a real estate trust that devotes its assets to property ownership and management, traded wtih Wiltshire South apartments at 3701 Connecticul Ave. NW. plus $970,000 in cash for an office building at 1901 Pennsylvania Ave. W.

The 100,000-square-foot office building, whose tenants include the World Bank, Cox Newspapers and Rubber Manufacturers Association, was sold for $4.3 million by Manufacturers Life Insurance Co. of Canada to a partnership headed by Marcel and Stephen Weiss.

Immediately after buying the office property, the Weiss partnership exchanged it for the Connecticut Avenue apartment complex, which has 260 units plus professional office suites, plus the cash.

WRIT purchased the Wiltshire South building in 1963 for $2.3 million and bought the ground under the apartments last June for $388.134. During its period of ownership, WRIT made capital improvements of $166.333 to the property, which was constructed adjacent to Rock Creek Park in the early 1950s by the Lenkin Co. The real estate trust's value of net equity in Wiltshire South at the time of yesterday's trade was more than double the total cash invested according to trust president B. Franklin Kahn.

In WRIT's annual report, officers told stockholders that the existence of rent control in the District made in "extremely difficult to assess" the future for four apartment complexes in the city then owned by the trust.

WIth yesterday's sale, WRIT now owns three apartments - the neighboring Wiltshire North, 400 Tunlaw Rd. and the Washington Circle Building.

Kahn declined to discuss the future of these properties yesterday but he did say that profits from operating D.C. apartments have been on a "downhill" trend and that under rent controls, "at the very best you can hold steady."

He said the question of the Pennsylvania Avenue building should lead to a "continuing improvement" in WRIT earnings. WRIT's annual report for 1976 noted that while tenants of the trust's shopping centers and other commercial properties have borne most increases in energy costs over the past two years, the trust itself absorbed most of the increases related to apartments.

Rents of D.C. apartments were increased 5 per cent last year but the company said it experienced a 20.8 per cent increase in apartment house repair and maintenance costs. The trust also owns four apartment complexes in Northern Virginia.

Spokesman for the Weiss partnership, organized as Wiltshire Associates, could not be contacted yesterday to comment on their plans for the D.C. apartment house. WRIT was prevented from converting the building to a condominium because of laws governing real estate trusts.

WRIT, in 1976, reported record profits for the 11th consecutive year. Net income was $2.4 million ($1.64 a share) compared with $2.1 million ($1.41) in 1975. WRIT attributed most of the gain to higher rentals in shopping centers.

Brokers that handled yesterday's trade were H.G. Smithy Co. and Bache Halsey Stuart, Inc. Negotiations took a year and a half, Kahn said.