David O. Maxwell takes over as chairman and chief executive officer of the Federal National Mortgage Association today at perhaps the most troubled period in the company's history.

An ultimate solution to the corporation's current woes is important to the entire nation, because Federal National Mortgage -- the largest Washington corporation in terms of assets -- is the largest single owner of housing mortgages. But the firm is suffering, like the savings and loan associations that make most mortgage loans, from record-high costs of borrowing money at a time when earnings from loans made in earlier years are farless.

In April, for example, Federal National Mortgage paid investors 13 3/4 percent when it raised $500 million by selling debentures, and it paid an average rate of 14.63 percent on short-term note sales. At the same time, its mortgage portfolio was yielding income at a rate of 9.3 percent.

Neither Maxwell, nor anyone else, is able to predict when the company, currently operating at a loss, will return to profitability. "I'm not going to kid you. . . . Interest rates would have to persist for a long time at a low level," before the company can begin to earn money again on its portfolio of $56 billion in housing, mortgages, Maxwell said in an interview.

Fannie Mae, as the firm is popularly known, suffered its most difficult year in 1980 as profits plummeted to $14.2 million from $161.7 million in 1979. In the first quarter of 1981 the company posted a record loss of $21.6 million. The outlook is that more quarterly losses will be reported for the balance of this year and into 1982.

The adverse impact of a cyclical rise in interest rates to record levels is so bad for Fannie Mae that Wall Street analyst Michael Lewis of E. F. Hutton Group in New York has stopped compiling predictions about the company's quarterly operations. "They can't seem to alter the cost of funds quickly enough. . . . The future is really out of Fannie Mae's hands," Lewis said.

At virtually any business enterprise, such a recent record and grim outlook would require wholesale cutbacks in personnel and operations, elimination of dividend payments to stockholders and a drastic reorganization of corporate strategy in an effort aimed at preventing insolvency.

But Fannie Mae is untypical in most respects. For one thing, it used to be a government agency. Founded as part of the New Deal in 1938, Fannie Mae had and still has a charter to support a secondary market for home financing by buying mortgages and thereby freeing up more funds for mortgages at the local level.

Under the Nixon administration, Fannie Mae was transferred into a private corporation with shares traded on the New York Stock Exchange.A quasi-government status was established through White House appointment of five of the company's 15 directors and with a somewhat vague mandate for the Department of Housing and Urban Development to regulate the firm.

With a charter that requires continued support of the mortgage market, there have been no wholesale cutbacks. Although directors of the company slashed the quarterly dividend rate in half to 16 cents a share in the fourth quarter last year, that dividend level was maintained in the red-ink first quarter. Because of prudent management in previous years, profits were ploughed back into the company so that today, Maxwell has a cushion of about $800 million in retained earnings with which to confront losses for some time.

Only in terms of a change in strategy has Fannie Mae started to move in fresh directions under Maxwell, who assumed the presidency of the company in February and who is scheduled to become chairman and chief executive at the firm's annual meeting here today. Before being selected as the successor to Oakley Hunter as Fannie Mae's chief, Maxwell was chairman of Ticor Mortgage Insurance Co. and before that he was general counsel of HUD.

"I want to put Fannie Mae on a basis where assets and liabilities will match over time, so we will not be hurt by cycles and gyrations" of interest rates, Maxwell said. Under one major program, which Maxwell said has been well received since it began March 30, Fannie Mae has offered to refinance mortgages it already owns at attractive rates to owners (permitting them to convert equity to cash). Some 4,400 commitments already have been made under this program, Maxwell said.

In addition, Fannie Mae is preparing to announce that it will participate in ownership of pools of mortgages originated by lending institutions, buying 90 percent of each pool in an effort to expand its market. This is a common practice, but it will be a new venture for Fannie Mae and could add a batch of higher-yielding mortgages rather quickly to the firm's overall portfolio to balance lower yields.

Although efforts to make Fannie Mae profitable will take a long time, Maxwell emphasized his view that when it turns the corner, "it will be very profitable as it was before." He predicted that interest rates are at or near their peak and that there are a number of "very encouraging" factors to indicate more stability in the nation's financial markets in future months.