Investors rushed to buy stock in District of Columbia banks yesterday, amid speculation that local banks will soon be bought at high prices by out-of-state financial institutions eager to take advantage of a new interstate banking law approved by the City Council on Tuesday.

Local bank stock prices jumped as much as $4 a share following the council decision, which for the first time would permit banks outside an 11-state region to enter the District if they buy a D.C. bank.

"It's the most hectic trading I've seen for this group of stocks in 25 years," declared Patrick C. Ryan, chief trader at Johnston, Lemon & Co.

The stock of Riggs National Corp. moved up $4 to close at $65 on 10,200 shares. American Security Corp. rose $1.75 to close at $34 on volume of 137,700 shares. American Security also gained $1.50 on Tuesday and $1.75 on Monday.

During the past 12 months, as the council has debated alternative ways to permit out-of-state banks into the District, Riggs' stock has moved up 95.5 percent and American Security's rose 103 percent.

The council's measure, adopted by voice vote on first reading, will come up for a final vote in two weeks and could take effect as early as May or June. Before banks outside the region could come into the city, they would have to make substantial financial commitments to the city. New York's Citicorp has been lobbying hard for banking privileges in the District.

In a defensive move, officials of Riggs National Bank, the city's largest bank, said yesterday they will speed up plans to expand into Maryland and Virginia. With the prospect of new competition for depositors' money coming from outside banks, Riggs officials said their plans have taken on greater urgency. Riggs said that it is looking for suburban banks it can buy within a year as a way to secure its presence in the area.

Banking sources said American Security, the area's second-largest bank, is talking to other banks about mergers or acquisitions, but officials at American Security declined to comment. Problem loans have been a persistent difficulty for American Security, making it harder for the company to buy other banks or be considered an equal in any possible mergers.

Bankers generally reacted favorably to the City Council's action, especially the provision that protects existing banks by allowing outside banks to enter the District only by buying a D.C. bank, rather than by setting up their own institutions.

"It's a very good thing for the shareholders of the D.C. banks," said a vice president of a small, local bank, who asked that he not be identified.

Robert Pincus, president of D.C. National Bancorp, said the measure passed Tuesday "is positive for the future of Washington." Smaller banks such as D.C. National will have to align with larger ones to get the cash and marketing resources necessary to compete with the nation's largest banks, he said. D.C. National, with assets of about $450 million, is awaiting approval to merge with Sovran Financial Corp. of Virginia, which has assets of $9 billion.

The boom in bank stock prices in the Washington area has been under way for a year, keyed to the score of mergers taking place among Maryland, Virginia and District banks. From January 1985 to July, stock prices of 17 Washington-area banks rose 61.1 percent.

Last spring, Virginia and Maryland adopted regional reciprocal banking bills, allowing banks in the Southeast and from Washington to do business within their borders through mergers or acquisitions. The District approved a similar law in the fall.

Six small D.C. banks that are considered possible merger candidates moved very little yesterday, said Ryan. Investors have been buying those stocks for months, he said, and are now waiting for further increases.

Two of the smaller banks did close higher yesterday. National Enterprise Bank closed up 50 cents at $13.25 bid. And McLachlen National Bank went up $2 to close at $40. Washington Bancorporation, which recently reorganized and is the parent of National Bank of Washington, rose $2 to $87 bid.

At the end of last year, the United Mine Workers of America sold its controlling interest in National Bank of Washington to a group of investors that includes senior management, New York and Washington businessmen and a Saudi Arabian financier.

"There's plenty of speculation that the new owners of the bank might resell," said Luther H. Hodges Jr., chairman of NBW. Hodges, who is one of the new investors, would not say who the prospective buyers might be.

Traders said the sudden rush of investors into D.C. bank stocks was keyed not to any specific merger rumors, but to a general sense that a new spate of interstate mergers soon will be possible.

Time has been an important factor affecting the value of bank stocks, Ryan said. Investors' judgments on the takeover value of the bank stocks has been tempered by the length of time -- perhaps three to five years -- that they thought they might have to wait for mergers to take place.

"Now, all that uncertainty has been removed," said Ryan. "The investor says, 'Holy cow. here it is.' They can buy it today and sell it, perhaps, in a few months. That's why everybody is jumping in."

Investors who bought earlier, he noted, were "reaping the benefits."

Robert Jones, vice president in charge of trading at Ferris & Co., said investors had been waiting for the District to be opened to interstate banking. Of the trading yesterday, he said, "It's been a dramatic move. . . . The market's just been sitting here, waiting for it to happen."

Lewis Sosnowik, a trader at the Lang Division of North American Investment Corp., said the rash of trading was based on a feeling among investors that "Washington banks are all going to be bought out." He added, "A lot of people didn't want to be left out."

Perpetual American Bank, a federally chartered savings bank, also rose sharply yesterday, up $3 to $27 a share, even though savings banks are not covered in the D.C. City Council legislation