International Business Machines Corp. has a problem other companies would like to have - it has been accumulating more cash than it knows what to do with. And today IBM announced that it is offering to buy back 4 million shares of its stock for $280 a share, or a total outlay of $1,12 billion.

The company said it was making the move because it "considers a purchase of its shares at this time to be an attractive investment for a portion of its funds."

IBM's holdings of cash and marketable securities at the end of 1976 totaled just over $6.1 billion, an amount that has been building steadily through the years and an increase of $1.4 billion over the year before.

Because IBM, the world's dominant computer manufacturer, is currently under challenge from the U.S. Department of Justice for monopolizing the market, some avenues of internal expansion or growth by outside acquisition available to other companies are foreclosed to it, which is why the cash grows.

"It's clearly a constructive move" for the price of IBM stock, commented Gideon Gartner, an analyst who follows the company for Oppenheimer & Co. "A bear could say they don't have anything they can do with their money - but what's new about that.

"It's another way of IBM expressing confidence in the future," said Gartner, and added it was also an alternative to further and faster dividend increases at this time which the company views as imprudent. Just last month, IBM raised its quarterly dividend by 25 cents, or 11 per cent, to $2.50 a share.

The 4 million shares IBM is offering to buy represent only 2.7 per cent of the 150.7 million shares the company has outstanding. The computer maker is the best capitalized company in the world, with its stock valued at S41.6 billion based on today's close, and it is also the largest holding in many institutional portfolios.

The stock, which closed Friday at S270.125, traded as high as $277 after the morning announcement, but closed the day on the New York Stock Exchange at $275.75, an increase of S5.625 for the day. Turnover totaled 101,200 shares.

The price of IBM shares has held up particularly well in the last year when other growth stocks have been badly battered. Its low for 1976-77 was $223.375 and its high was $288.50. Last year, the stock appreciated about 24 per cent in value.

IBM recently reported 1976 net earnings of $2.4 billion ($15.94 a share), an increase of 21 per cent over the year before when it earned $1.99 billion ($13.35). Gross income from sales, rentals and services rose 13 per cent to $1.63 billion.

The company said its offer to purchase shares at $280 will expire on March 7, at 5 p.m. unless extended. The price of the stock is expected to move toward that level by that date, with a small discount expected because it is not known whether all shares tendered will end up being purchased by IBM.

IBM said the offer is not conditioned upon any minimum number of shares being tendered and that the company is obligated to buy all shares.

If more than that amount is tendered, IBM has the option to purchase more shares up to a total of 5.5 million, but no more. If the offer is over-subscribed, IBM said it would make the purchases on a pro rata basis.