The Maryland General Assembly, moving in frenzied fashion five days before adjournment, took two leaps into the future tonight by approving legislation paving the way to interstate banking and banning phosphate detergents, and one step into the past by passing a bill legalizing the limited use of slot machines on the Eastern Shore.

Related legislative stories on Page B1.

Working late into the night and cutting procedural corners, the state Senate approved controversial legislation granting Citicorp, the huge New York City bank, authority to open branches in Maryland. In return, Citicorp plans to establish a credit card facility with hundreds of new jobs in Hagerstown. The measure must still be approved by the House of Delegates, which has already adopted a similar but less restrictive measure. The Senate also passed a regional banking compact that opens the state to banks from 14 other states and the District of Columbia.

The House and Senate also enacted legislation that would permit the return of slot machines to eight Eastern Shore counties, 22 years after the legislature banned the gambling devices, which had flourished for a generation in four southern Maryland counties.

The House of Delegates rebelled against a furious lobbying campaign by industry and adopted legislation prohibiting the use of phosphate detergents in Maryland for three years beginning in July. That measure must still be reconciled with a stricter Senate version that does not contain a number of exemptions added by the House.

The quick actions left some legislators and observers surprised.

"When you have the momentum, you have to keep going, otherwise you lose it," said Senate President Melvin A. (Mickey) Steinberg (D-Baltimore County), who feared that other major pieces of legislation would be jeopardized in the waning days of the legislature if he didn't push the Citicorp and slot machine bills tonight.

"The session's been slow until now, and all of a sudden we passed all three of these bills inside of 45 minutes," said Sen. Stewart Bainum Jr. (D-Montgomery). "What Mickey did was smart as hell because all the bankers' lobbyists went home to draft amendments to the Citicorp bill" after it passed the preliminary vote early in the evening.

Tonight's flurry of activity came as the legislature drew near its midnight Monday adjournment and was designed to ease crowded calendars in preparation for a weekend of religious holidays. It was a sharp contrast to a relatively slow-paced session, but one that has come to be dominated by late-breaking issues that had not been anticipated when the assembly convened in January.

It also proved to be the denouement for two of the legislature's most heavily lobbied issues, the bill to give Citicorp a distinct advantage in Maryland over the strenuous objections of state banks and the measure to ban phosphate detergents.

Under the legislation approved 36 to 11 by the Senate tonight, Citicorp, a bank holding company whose assets are more than seven times larger than all Maryland banks combined, would be permitted to establish 20 branches in the state beginning in mid-1986. In return, Citicorp has agreed to establish a credit card center in the economically distressed Hagerstown area, a controversial quid pro quo that was announced by Gov. Harry Hughes a month ago.

The phosphate ban, approved 79 to 48 by the House, exempts about 35 percent of state residents from the prohibition on using the laundry products, but paradoxically does not allow them to purchase the detergents within the state's borders. Proponents claimed the vote as a rare victory for environmentalists this session and a tribute to the House's ability to resist the blandishments of at least a dozen well paid industry lobbyists.

In enacting the slot machine bill that will permit use of the machines at nonprofit fraternal, religious and veterans organizations, the Senate appeared to boost the chances of another bill requiring the licensing and auditing of other forms of gambling. Key House members had agreed to the gambling bill in exchange for support for the slot machine measure, which exempts Worcester County, home to Ocean City.

Hughes has suggested, however, that he may veto the slot machine bill. "I am not comfortable with it," the governor said at his regular weekly news conference today.

After tonight, some of the focus of the 1985 session has now shifted back to Hughes, who also expressed reservations about weakening amendments added to the phosphate ban by the House.

"There seem to be some very questionable legal aspects of the bill as it now exists," he said. "I'd really hate to see that bill get up [here] in such shape that it isn't worth signing."