Only weeks ago, Prince George's County's legislative delegation was pleading with Gov. Harry Hughes for $12 million in education money and bemoaning the loss of nearly that much in federal revenue-sharing funds.

Imagine the surprise among legislators and others when County Executive Parris Glendening sailed into the state capital a week ago to announce that the county had solved its immediate fiscal woes and wouldn't need the legislature's help this year after all.

Concerns over teachers salaries, overcrowded classrooms and the expansion of the county's experimental magnet school desegregation program would all be resolved, Glendening said, thanks to $40 million in money that his budget analysts have discovered through "internal adjustments."

No one could say where the money was coming from, but school officials and legislators were anxious to embrace Glendening's plan as a solution to their problems.

It was a victory for the schools, according to Prince George's school Superintendent John A. Murphy and several members of the county's House delegation.

But other legislators, many of whom are supporters of Attorney General Stephen H. Sachs' gubernatorial bid, said they suspected that the announcement had political overtones. They said it was the result of behind-the-scenes maneuvering between Glendening and a major Prince George's backer of Baltimore Mayor William Donald Schaefer, Thomas V. Mike Miller Jr., chairman of the county's Senate delegation.

Up until last week, Miller's Senate delegation seemed likely to kill a bill that would have given the county new taxing authority, a move that would have been at odds with their professed desire to bring home money for the school system. Glendening's announcement saved them the trouble.

Glendening is now eager to align himself with Schaefer forces because he is convinced he will have to deal with them in the Statehouse next year, some politicians believe.

All the legislature had to do to cement the deal, Glendening said, was to promise to give the county new taxing authority next year. Prince George's officials have said in the past that such authority could bring in millions of dollars in added revenues annually.

The deal, which was basically an oral agreement between Glendening and Miller, was hammered out late last Thursday night, barely in time to present it as a fait accompli to a meeting of the county's House delegation early Friday.

Glendening said that his announcement, made before a gathering of his aides, school board members and school union officials, showed how far Prince George's has come since the fiscally gloomy days of tax limitations and mass layoffs.

County officials have said they will lose $11.8 million in revenue-sharing funds because of federal reductions this year. When Gov. Harry Hughes provided only $3.5 million in his budget for magnet schools, it fell far short of the $12 million legislators had requested.

"To take a hit on the loss of revenue sharing and a double hit on magnet funding and still be able to come out ahead shows our ability to absorb these losses in the county," Glendening said after his announcement.

To others observing the byplay between Miller and Glendening, the agreement spoke more of how close the two men, traditionally distrustful of one another, have come in working out an election-year relationship that is mutually beneficial.

Prince George's Education Association President Paul Pinsky, however, was disdainful of the agreement, saying it was another delay in the campaign to give the county the fiscal power it needs. And the four delegates who sponsored a bill that would have allowed the county to levy a commercial energy tax were stung by Glendening's preemptive strike and angered that he had supported their effort just until he could think of something better.

"Several assessments were made that the votes were not there," Glendening said of the energy tax proposal.

School board members, however, were delighted with the news about found money. "We're certainly in better condition today than we were last night," chortled member Norman H. Saunders last Friday.

"I absolutely believe Sen. Miller's commitment, and believe that he will keep it," added fellow board member Thomas Hendershot.

It was not immediately clear where the money, about $26 million more than was expected in normal budget growth, will come from, and those details may not come to light until Glendening's county budget is released at the end of next month. That budget is expected to increase from $605 million for the fiscal year that ends in June, to well over $639 million for the fiscal year that ends in 1987.

"They're cutting to the bare bone," said Del. Joan Pitkin (D-Prince George's). "Our perception is that they're playing a dangerous game with reserves that might not be there."

The real gamesmanship, as is normal in election years, is more likely being played out in political circles. Sources on both sides of the gubernatorial nomination race shaping up between Sachs and Schaefer are now saying that Glendening has decided privately to back Schaefer.

In public, Glendening stays on the fence, endorsing neither candidate. Several delegates, Secretary of State Lorraine Sheehan and three of Glendening's top county appointees are all working for Sachs. Meanwhile, Miller, Laurel Mayor Robert J. DiPietro and several other elected officials have been toiling for Schaefer.

"Everybody wants to be part of a winning team," said Miller, citing opinion polls that show Schaefer well ahead in Prince George's. "Parris is closely attuned to William Donald Schaefer."