The nation's two biggest banks today officially ratified the first serious decline in bank lending rates since last July.

Both Bank of America in San Francisco and Citibank of New York today lowered their prime lending rate from 21 1/2 percent to 20 1/2 percent. The move was followed by a host of smaller banks.

The 21 1/2 percent rate was the highest that key lending charge had ever reached, surpassing the 20 percent record it touched last spring, just before a sharp decline in interest rates that continued into the summer.The prime rate fell to 10 3/4 percent last July.

Several major banks -- including Chase Manhattan, the country's third-biggest -- reduced their prime rate to 20 1/2 percent before Christmas to reflect substantial declines in open-market interest rates. Several more big banks, including New York's Chemical and Morgan Guaranty, did so earlier this week. The prime rate is the interest banks charge their best corporate customers for a short-term loan and is the rate on which many other borrowing charges are based.

Analysts say that the steady decline in interst rates in the open market, where banks borrow many of the funds they then lend to their business customers, presage further prime rate declines in the next few weeks, although no one expects rates to decline as quickly as they did last spring.

Even though the sluggish economy and record interest rates have restricted business loan needs somewhat, loan demand remains fairly strong.

The retreat from the record prime rate has been much more scattered than the ascent, when the first bank to increase its prime rate -- more often than not Chase Manhattan -- was followed within hours by nearly every major bank in the country.

Many banks hesitated to lower their prime rate for businesses until they were sure the interest rate decline would last. Banks also tried to recoup some of the profits they lost during the last two months when increases in their borrowing charge to customers did not keep pace with the cost of funds they were raising in the open market, analysts said.

The prime rate stood at 14 1/2 percent in early November and rapidly climbed to the 21 1/2 percent record by mid-December.

Since Dec. 12, when many interest rates in the open market reached their peaks, bank borrowing costs have declined sharply. For example, the interest rate on the key securites, 90-day bank certificates of deposit, has fallen from more than 21 percent on Dec. 12 to less then 17 percent today. Banks borrow much of the money they re-lend to customers in the open market.

The major exception has been interest rates on so-called federal funds, money that banks lend to each other overnight. Federal funds rates rose sharly early this week and have been in the 20 percent range since Monday. The federal funds rate is controlled in large part by the Federal Reserve Board, the nation's central bank and the architect of monetary policy.

Heavy demand for loans on the part of the nation's brokerage firms -- a normal occurrence near the end of the year -- has increased the demand for federal funds on the part of major banks. Banks generally lend to brokers overnight and as a result try to finance broker loans in the federal funds market. Furthermore, the Federal Reserve has been stingy in supplying reserves to the banking system, adding to interest rate pressures in the federal funds market.

As a result of the rise in the federal funds rate, several banks that reduced their broker rate last Friday and Monday raised them again Tuesday to 20 1/2 percent.