Citicorp, the nation's largest bank holding company, has agreed to pay oil billionaire Gordon Getty $4.5 million to settle an 18-month battle for ownership of the District's second-largest savings and loan, federal regulators announced yesterday.

Under the agreement, Citicorp will retain ownership of the ailing S&L, formerly called National Permanent Bank.

Last summer, Citicorp won National Permanent in an auction by federal S&L regulators and renamed it Citicorp Savings. Getty, who lost in the auction, filed and won a suit contending that the bidding was improper.

Yesterday's settlement spares Citicorp the embarrassment of losing control of the S&L and having to find an alternative way to open a full-service financial institution in the District. But it adds several million dollars to the New York bank's cost of doing business in the District.

The federal government paid Citicorp $51.8 million last year to take over the ailing S&L, whose liabilities exceeded its assets by at least $80 million. The S&L has $1.1 billion in assets and 14 offices.

Under yesterday's settlement, Citicorp will repay $2 million to the Federal Savings and Loan Insurance Corp. in exchange for agreeing to the settlement. In addition, it will pay Getty $1.5 million in legal fees and $3 million to settle any claims he may have against Citicorp or the government.

Last summer, after Getty sued over the bidding process, a federal appeals court ordered the FSLIC, the federal agency that oversees the sale of ailing S&Ls, to accept new bids from Citicorp and Getty.

Getty's lawyer had no comment yesterday.

The 18-month battle produced bad publicity for Citicorp. In addition to having ownership of the sick S&L thrown up in air, Citicorp tactics to win local and federal approval to enter the District was questioned by the U.S. attorney's office.