One of the best kept secrets of the 1978 mortgage market - a program that provides highly advantageous financing for buyers of small, multi-unit residential buildings in cities - is about to come out of the dark.

This program of the Federal National Mortgage Association, for two to four-unit buildings, is only three months old. A handful of S&Ls and bankers here and in other major cities have started offering the loans as buyers have become interested in them. Among the features of the program:

Mortgages well over $100,000, with downpayments as low as 5 per cent, for people who want to buy houses with two to four units. The buyers are those who plan to live in one unit while using the rental income from the others to help meet monthly mortgage payments. This fits the needs of many couples or small households who want to live in town but who can't swing the high downpayments and purchase prices of the large, multi-unit rowhouses they find so attractive.

Mortgage for investors who want to purchase mini-apartment buildings for remodeling or rental in central cities but who don't plan to live in the properties. For such purchasers the downpayment terms are slightly stiffer, but allow an investor to put as little as 20 percent of his or her own money and still come away with a threeor four-unit brownstone or rowhouse costing $150,000 or more.

With secondary financing, the downpayment can be cut to just 10 percent - with no mortage insurance.

A virtually guaranteed source of mortgage money - albeit at the going market rate - for buyers in these two categories who can use it. Investors who have found S&L windows closed tight in the past week can make immediate use of the program. Home buyers in the District and Maryland who are covered by 10 per cent usury ceilings could have a problem qualifying if rates go any higher, but buyers in Virginia, where there is no usury lid, should find it a breeze.

The lending program is the outgrowth of shift toward greater urban involvement by the Federal National Mortgage Association. This is a congressionally chartered private corporation, based here, that owns more mortgages than any other entity in the U.S. - about $34.3 billion worth of them. The corporation aids the mortgage market by purchasing home loans originated by mortgage bankers, s&Ls, banks and others, therby freeing up local money for renewed mortgage lending.

Although the program for two to four-unit lending was announced in February, the corporation hasn't pushed it hard, preferring to let mortgage lenders get their feet wet slowly. As a result, only a relatively small numbers of lenders really are aware of the program's terms.

Those who have mastered its appraisal forms and mortgage calculations - such as Kitti Peshak, branch manager in Alexandra for Steed Mortgage Co., say it's taking off very fast.

She says the program is "phenomenal" because it "responds so well to the market in the city as it is today." It provides money on terms that are equivalent to the best in the conventional, low-risk loan market.

Fannie Mae had this in mind when it designed the lending program. Cities like Boston - where upwards of 90 percent of the residential buildings are small, multi-unit structures - have needed a new financing source to revive neighborhoods.

Large city neighborhoods such as Capitol Hill, Adams Morgan and Mt. Pleasant - along with their counterparts in San Francisco, Philadelphia, Chicago, and New Orleans - contain tens of thousands of buildings that combine ownership and rental possibilities. The problem is that these buildings often are costly and mortgage lenders refuse to count the projected income from rental units in qualifying applicants who plan to be occupant-owners.

Fannie Mae's program permits lenders to count that income, but imposes tough appraisal standards, code compliance rules and financial checks on borrowers. Fannie Mae will buy loans on two to four-unit urban properties, but insists that they be high-grade investments.

If an applicant contends that two of three units in Capitol Hill town house can be rented out for combined $700 a month, for instance, Fannie Mae won't just take that for granted. Before the mortgage banker or S&L gets the go ahead on the loan from the corporation, an intensive study must be made of the property by an independent appraiser, using rent levels and purchase prices from several comparable properties in the area. This adds a few days to the process and about $100 per unit in appraisal fees, but Fannie Mae insists upon it.

The precise mortgage amounts available under two to four-unit program vary city by city, according to a set of market maximums that Fannie Mae uses and which are available at particpating lenders' offices.

In Washington, for example, the maximum mortgage for a three-floor and English basement rowhouse with a total of four one-bedroom units would be $121,824. The amount would be slightly less for the same building in Alexandria or Baltimore.

The downpayment minimums, however - 5 percent for qualified owner occupants and as low as 10 percent for investor - stay the same in every market.

In this area Advance Mortgage Corp. and Colonial Mortgage Corp. of D.C. are among those firms active in the Fannie Mae program.

Kenneth R. Harney is editor of the Housing and Development Reporter, published weekly by BNA, Inc.