The Federal National Mortgage Association (Fannie Mae) announced this week that it will purchase a total of up to $25 million in loans made to some landlords who want to improve their low-income apartment buildings in deteriorated neighborhoods.

Fannie Mae chief executive David O. Maxwell said the move will prompt banks and savings and loan associations to lend money to low-income-apartment owners who, he said, have had trouble obtaining money to rehabilitate their buildings.

Fannie Mae will then buy the loans in the secondary market at its usual rates, he said.

However, only landlords who are involved in rehabilitation projects sponsored by Neighborhood Housing Services of America, a nonprofit corporation, will be eligible for the loans, Maxwell said.

"This is a way for Fannie Mae to combine with a public-interest group," he said.

"This program addresses two major issues in which our corporation has a deep concern and commitment -- affordable housing for low-income families and revitalization of urban neighborhoods through housing rehabilitation."

The Metropolitan Life Foundation, a corporate philanthropic organization, is providing a $200,000 interest-free loan to Fannie Mae to trigger the $25 million commitment to purchase the loans, according to John J. Creedon, foundation chairman. Metropolitan Life also is providing $5 million to Neighborhood Housing Services, which will use the money to provide low-cost loans to low-income homeowners who are having trouble financing repairs on their homes, Creedon said.

The creation of the $5 million fund and the commitment by Fannie Mae were announced Wednesday, the same day President Reagan proclaimed a "National Neighborhood Housing Services Week" at a ceremony in the White House.

According to its directors, Neighborhood Housing Services will use the newly available loans to aid ongoing projects to revitalize low-income neighborhoods in 137 cities, including Washington. In a prototype program in Yonkers, New York, about 4,000 apartment units in 100 buildings were improved.

The directors said this type of program is possible only if building improvement loans can be sold in the secondary market.

Neighborhood Housing Services directors also said it is unlikely that landlords will use the available loans to improve their buildings, then pass over their former tenants in favor of higher-income tenants who can pay higher rents.

"This doesn't lead to a gentrification," said William A. Whiteside, a director of Neighborhood Housing Services. "There are no guarantees. . . . It is very unlikely for them to raise rents. We work with the whole neighborhood very closely."