The Federal National Mortgage Association has adopted "a whole new way of doing business during the last two years" that has enabled it to return to profitability, and management intends "to do everything in our power to keep it that way," association Chairman David O. Maxwell said yesterday.

But Maxwell warned stockholders at yesterday's annual meeting that "major upswings in interest rates, perhaps as soon as the fourth quarter of 1984, look entirely possible to us. . . ."

And while he told the stockholders that "we mean to immunize the company, to the greatest extent possible, from the dangers of economic and credit cycles," he noted in testimony to a House Banking subcommittee Tuesday that "FNMA as an institution is extremely vulnerable to swings in interest rates."

Fannie Mae, as the association is known, made $15 million in the first quarter of this year after losing a total of $295 million in 1981 and '82. The association's principal business is buying mortgages, either to hold in its own portfolio or for resale to investors, thus providing lenders with cash to make new loans.

During the big interest rate run-up of the past several years, Fannie Mae, like many savings and loan associations, found itself holding low-rate, long-term mortgages that it had to finance with high-rate loans. This "asset-liability imbalance" threatened to ruin the association, and Maxwell and his associates have been working frantically since they took over in early 1981 pull Fannie Mae back from the brink.

Yesterday, he was able to say with obvious pleasure, "Fannie Mae is profitable again." He pointed out that the association's stock, which was trading at 8 7/8 on the day of the 1981 annual meeting, was at 26 5/8 yesterday.

Maxwell said losses on Fannie Mae's portfolio have been narrowed significantly and "we can and will" make sure that new purchases provide a yield greater than the cost of new debt.

In addition, he said that the association has been able to generate substantially increased income from fees, both from services and from guarantees on mortgage-backed securities.

In the future, he said, Fannie Mae will aim to increase the number of shorter-term mortgages, such as second trusts, that it buys, and will emphasize adjustable rate mortgages, which rise as interest rates do. At the same time, the association will move to lengthen the terms of its debt.

Changing Fannie Mae's huge portfolio cannot be done rapidly, however, particularly since it contains $34 billion in mortgages that mature in 11 to 40 years. Many of these are low-rate, assumable FHA and VA loans that are not likely to be paid off.

Maxwell noted that even with his new initiatives in place, Fannie Mae will have only about 10 percent of its portfolio in short-term or interest sensitive mortgages by 1984 when he foresees another possible round of interest jumps.