A federal judge in San Francisco ruled yesterday that the government illegally seized an ailing savings and loan association last April, and he ordered that the federal receivership be lifted. The judge is expected to rule today on who now controls Fidelity Savings and Loan Association of Oakland.

Although there have been several previous lawsuits brought by S&Ls that were merged forcibly by the Federal Savings and Loan Insurance Corp., this is believed to be the first time a court has ever decided against a government-engineered seizure.

Should the decision be upheld on appeal, it could influence legislation now before Congress to give regulators more power to merge troubled thrift institutions out of existence.

This trend has been opposed bitterly by the industry, which risks being reduced by one fourth or more if high interest rates continue to drain its reserves.

In his opinion, U.S. District Judge Spencer Williams stated, "No matter how well intentioned or motivated by apparent economic necessity its actions, the FHLBB acted in violation of both clear command of the applicable federal statute and the underlying policy which limited federal intrusion in the supervision of state associations."

He added, "Congress certainly did not envision a CIA-like operation where the Federal Home Loan Bank Board orchestrates a neat, five-minute closure to effect paper satisfaction of the statutory requirements with the state acting as an unwilling co-conspirator."

The allusion is to the methods used to declare Fidelity insolvent last April and place it in receivership. The FSLIC, an arm of the bank board, directed the California savings and loan commissioner to seize the state-chartered stock corporation against its will and turn it over to the FSLIC.

The FSLIC feared Fidelity's imminent collapse. The S&L suffered an operating loss of $57 million last year and was losing money at the rate of $5 million a month in early 1982. Yet it had almost $20 million of remaining net worth or reserves when it was seized.

The FSLIC turned Fidelity into a mutual S&L immediately, thus wiping out the stockholders. The major stockholders, who were also Fidelity's officers, sued to stop the procedure.

The FSLIC has sought bids from financial institutions interested in taking over Fidelity, the country's 21st largest S&L. Some have been received from as far away as New York. Meanwhile, Fidelity is being run under a management contract with Home Federal S&L of San Diego.