Secretary of Housing and Urban Development Patricia Roberts Harris has asked the Carter administration to support legislation that would increase the federal government's role in the Federal National Mortgage Association.

The legislation and HUD's support signal a major battle over the control of the quasi-governmental company.

Senate Banking Committee chairman William Proxmire (D-Wisc.) and Sen. Alan Cranston (D-Calif.) have introduced a bill that would increase the size of FNMA's 15-person board of directors by 4 - all to be appointed by the President.

The bill also would require FNMA to make the same kinds of public disclosures under the Freedom of Information Act that other federal agencies must make.

FNMA, however, is launching an "all-out effort" to thwart the legislation.

In the process, the Washington corporation appears headed for a tough internal struggle as well as a larger confrontation with members of Congress who believe that FNMA has not acted adequately to aid the nation's housing, particularly in the cities.

The Washington firm, nicknamed Fannie Mae, was established as a government agency in 1938, but in 1970, was transformed into a public corporation with stock traded on the New York Stock Exchange and with loose ties to HUD, which retained ambiguous regulatory authority.

Now factions in the Carter administration want to assert a larger federal hand in directing FNMA's activities and informed sources said yesterday that all affected agencies in the federal government are in agreement on the policy merits of the Proxmire-Cranston bill. Although the legalities are being researched, Carter is expected to endorse the legislation, sources said.

The forthcoming battle could cost Fannie Mac chairman Oakley Hunter his job, although an aide to Proxmire said yesterday that is not a goal of the Wisconsin Democrat. JoAnn Barefoot of the Senate Banking Committee staff also characterized FNMA attacks on the legislation as "grossly misleading" and "scare" tactics aimed at arousing stockholders.

Fannie Mae's new crisis surfaced in strong terms at the corporation's annual meeting yesterday and Hunter was notably absent. Company officials said he had been hospitalized on May 8 for "periodic irregular beats of the heart" with no evidence of a heart attack. Hunter will remain in the hospital until next weekend and will not return to work for about three weeks, FNMA said.

Hunter's illness means he will not be able to testify before Proxmire's committee at hearing on June 7-8 on the proposed legislation. FNMA senior vice president and general counsel James E. Murray said Hunter has no intention of resigning.

Meanwhile, Lester P. Condon, the FNMA executive vice president who read Hunter's annual report to the meeting, charged that the Proxmire-Cranston bill was "unconstitutional" because it would amount of a "taking of shareholders' rights without due process."

Increasing the number of public directors named by the President to a 20-member board to 9 would dilute stockholder control, he said. FNMA has hired the Washington law firm of Williams and Connolly "to assist us in convincing the Congress of the injustice of the proposed legislation and to contest it in the courts if it becomes law," Condon stated.

However, with the appointment yesterday by President Carter of four members to the board (five slots were opened), FNMA now has a board divided on the [WORD ILLEGIBLE] HUD general counsel Ruth Prokop, one of the new appointees, yesterday said she supports the legislation and believes it is constitutional.

Also named to FNMA's board by Carter was Raymond H. Lapin, who heads a San Francisco mortgage finance firm and was first president and chairman of FNMA as a public corporation.

Lapin, widely rumored as the administration's choice to replace Hunter, was ousted from the FNMA job by former President Nixon, who selected Hunter. FNMA's board subsequently won control over appointment of the chairman, and Hunter's five-year contract which expires in 1980, guarantees him an annual salary of $122,000.

Last year, Lapin made several trips to Plains, Ga., as a key adviser to Carter on housing issues. After yesterday's meeting, Lapin declined to take a position on the Proxmire-Cranston bill. He said he hadn't studied it thoroughly and didn't know what FNMA officers were "so upset" about. Lapin also declined to discuss whether he might be pushed as a successor to Hunter.

Carter named two other board members yesterday and has one vacancy to fill. Those selected were:

Washingtonian John D. Thompson, president of the National Association of Real Estate Brokers, an organization of black real estate brokers, head of Vijon Realty Co. "I feel that my input and even my appointment is a result of my expressed concern about the inner cities of America," he said.

Marvin S. Gilman, associate professor of urban affairs and public policy at the University of Delaware. He also is active in the National Association of Home Builders

Earlier this year, Proxmire contended that FNMA's board of directors "is overwhelmingly on the side of private interests and has little consideration for the public interest."

He said his legislation is not aimed at destroying Fannie Mae as a profit-making corporation designed to aid housing through purchases and sales of home mortgages.

FNMA's Condon complained yesterday, however, that the legislation would be "adverse" to the interest of stockholders. The Freedom of Information Act "was not intended to be applicable to private corporations," and if FNMA were required to open up all its documents to the public it would create "an intolerable situation," harming investors and depriving FNMA of its rights under the Constitution, he said.

Last year, Fannie Mae had record profits of $126.8 million (2.62 a share) and purchased $3.6 billion of mortgages.

In the first quarter of 1977, FNMA earned a record $42.8 million compared with $29 million in the 1976 period.