A federal judge ruled yesterday that federally chartered savings and loan associations may not offer interest-bearing checking accounts to state and local governments.

The ruling by U.S. District Court Judge John Lewis Smith Jr. is a victory for the nation's commercial banks that vigorously had opposed what they claimed would have been an unfair competitive advantage for S&Ls.

Prior to this year, NOW (negotiable order of withdrawal) accounts were available only at institutions in New England and New York. However, Congress enacted legislation last year authorizing depository institutions nationwide to offer beginning this year the interest-bearing checking accounts to individuals but not to corporations.

The Federal Home Loan Bank Board, which regulates federally chartered S&Ls, had adopted a resolution last month that would have allowed all private and nonprofit organizations and all government organizations to establish NOW accounts at federally chartered S&Ls.

The Federal Reserve, meanwhile, adopted rules prohibiting commercial banks under its jurisdiction from offering NOW accounts to similar organizations.

The Fed's ruling, which had been suspended pending yesterday's court order, becomes effective today.

Under Fed rules, banks may offer NOW accounts to individuals, including businesses operated as sole proprietorships as interpreted by the Internal Revenue Service, and government units if the funds are in their name and used for schools, universities, libraries, hospitals and other nonprofit facilities.

The American Bankers Association had argued that the disparity between bank board and Fed rules for NOW accounts would have resulted in the loss of more than $4 billion in deposits that would have flowed from commercial banks to S&Ls.

The industry trade group therefore asked the court either to declare the bank board regulations invalid or to find the Fed's rule unlawful.

Smith ruled yesterday that the bank board's proposed regulations interpret too broadly the statutes that authorize NOW accounts, and he therefore granted the ABA's motion for a permanent injunction against the bank board's regulations, which had been scheduled to go into effect yesterday.

Bank board Chairman Richard T. Pratt sharply cricized the decision, which blocks the deposit of a potentially large source of funds into accounts at the nation's troubled thrifts.

"This decision emphasizes the need for further analysis and re-evaluation of the type of deregulation that should occur among financial institutions today," Pratt said yesterday.

"It continues to amaze me that anyone could argue that Congress could have intended that the National Football League and the Potomac Country Club could have NOW accounts, but that the City of Princeton could not," he added.