LONDON (AP) _ Bearish speculators who bet heavily that the dollar would continue to slide got caught in a painful squeeze this week when the dollar jumped following unexpected intervention by central banks.

The coordinated move by the U.S. Federal Reserve, the Bank of Japan, and other central banks to buy billions of dollars on Monday and Tuesday sent the speculators scrambling to buy dollars to minimize the damage.

The stakes are huge, with an estimated $100 billion of trading worldwide each day, and the speculators' losses could run into millions of dollars.

''Most people ran for cover,'' said Peter J. Beckett, chief dealer at Canadian Imperial Bank of Commerce in London.

The Financial Times, Britain's leading business daily, said: ''The success of the U.S. Federal Reserve and the Bank of Japan in digging a highly successful trap for bears of the dollar in the New Year markets should at least restore a healthy fear of central banks in exchange markets.''

The newspaper said: ''By allowing bear raids to develop some enthusiasm, and intervening only when the speculative part of the market was short, they were able to impose painful losses.''

Going short is the selling of dollars, expecting to be able to repurchase them in the future at a cheaper rate.

The Financial Times said: ''It is not so much the timing of the latest raid which shows that the trap was deliberately planned as its determination. The markets turned as soon as they knew that the Fed was leading the support operation.''

The newspaper added: ''The fact that they (the central banks) spent heavily to drive the dollar up some 2 percent shows that they were after blood.''

The speculators' widespread betting against the dollar had been one factor contributing to its weakness.

Central banks surprised the markets by intervening when the dollar wasn't under heavy selling pressure.

David Osman, senior international economist at the London investment firm James Capel and Co., said, ''It already looks like the central banks are trying to push the dollar back up instead of just smoothing its fall, since Tuesday's intervention occurred when the dollar was already recovering.''

For the speculators, the concerted intervention on Monday and Tuesday was what they call a ''bear squeeze'' - it squeezes them out as the dollar's value is pushed up.

What the speculators had to decide was whether to hold out for a lower rate or bail out on the belief that the dollar would not drop further for the time being.

Hanging in for a lower rate means risking paper losses that could grow if the dollar climbs.

Bailing out, or buying dollars that previously had been sold, entails taking on immediate losses.

Many of the speculators, who include multinational corporations and institutional investors, lost their nerve and opted out. They moved quickly to cover their short positions, or to fulfill their agreements to sell dollars.

''It's been really one-way traffic up. People who have been holdng positions have been badly burned,'' Beckett said. ''To what extent, I don't know.''

He added, ''But once we started to move, people started to dump short positions.''

Many speculators hadn't taken seriously a statement on Dec. 23 by the Group of Seven nations reaffirming their desire for currency exchange rate stability, which also added to the surprise.

The group is made up of the United States, Japan, West Germany, France, Britain, Italy and Canada.

There are no statistics on how much short-covering actually has taken place. Dealers said it was moderate to heavy. There also are no statistics on the speculators' losses.

Fortunately for them, speculators had closed their books for calendar 1987, locking in their profits for last year.

Now, these speculators might bet on the upside, or go long.

To do that, they would buy dollars to sell them in the future at what they hope is a better rate.

''If they believe the central banks mean business and they believe that they will continue to push the market up, you may have people taking long positions,'' Beckett said.

But the dealer added, ''It's very dangerous.

''It (the dollar) could easily go back down again.''