NEW YORK — Stock prices plunged sharply amid heavy computerized program trading in the last hours of Thursday's session.

The Dow Jones average of 30 industrial stocks, down from 5 to 10 points for most of the session, wound up the day at 1,862.20, off 31.50 points from Wednesday's close.

Losers outpaced gainers by about a 7-to-3 margin, with 1,098 losers, 476 gainers and 440 issues remaining unchanged on the New York Stock Exchange.

Big Board volume totaled 163.95 million shares, against 162.19 million on Wednesday.

Jack Baker, head of block trading at Shearson Lehman Bros., said the late move was "99% program related," adding that there was no institutional trading as the late-afternoon plunge picked up momentum.

Hildegarde Zagorski, an analyst at Prudential-Bache Securities, said she believed the fall resulted from lack of leadership in the market over the past two weeks.

Investors Take Profits

"The only stocks to go up were 'deal stocks' or stocks that were related to deals. The rest of the market did nothing at all," she said. "So we knew one day it would come tumbling down, and maybe today was the day."

Both analysts said stock-index futures were selling at a discount in the afternoon. This kicked off computer programs written by Wall Street professionals to buy the futures and sell "baskets" of the underlying individual stocks.

Earlier, analysts had attributed some of the morning trading to profit taking in response to the failure of the Dow Jones industrial index to break through the 1,900 barrier.

They also said continued uncertainty about the direction of the economy was also dampening investor enthusiasm.

Analysts said traders were looking ahead to today's release of October government reports on producer prices, retail sales and industrial production. If these indicate more strength in the economy, bond prices could decline amid diminished prospects that the Federal Reserve Board would ease interest rates. This, in turn, could put a damper on stocks, they said.

Bond prices move in the opposite direction of interest rates.

Gillette, which has been the subject of takeover rumors, led the most active stocks at the New York Stock Exchange. It closed down 1/2 at 57 3/4.

Bally Sharply Higher

Eastman Kodak was up by 5/8 at 66 1/8. On Wednesday, the company predicted higher 1987 sales and earnings.

Mesa Petroleum was up at 3 3/4.

Bally Manufacturing was up 4 at 21. The company said it knew of no reason for the rise.

Holiday Corp., which announced a $2.8-billion restructuring proposal on Wednesday, was down 2 at 74 1/2.

Lockheed Corp. gained 2 1/2 to close at 47, while Ford Motor closed at 56, down 1 1/8, after a rumor swept the market that Ford was interested in acquiring Lockheed. A Lockheed spokesman said there was no substance to the rumor, while a Ford spokesman would neither confirm nor deny the report.

K mart Corp. lost 1 to close at 52.

Pandick Inc. was up 1/2 at 24 3/8.

Large blocks of 10,000 or more shares traded on the NYSE totaled 3,306, compared to 3,418 on Wednesday.

Nationwide turnover in NYSE-listed issues, including trades in those stocks on regional exchanges and in the over-the-counter market, totaled 200.17 million shares.

The Wilshire index of 5,000 equities closed at 2,465.623, down 32.099.

At the American Stock Exchange, the market-value index fell 1.89 to 266.76.

The NASDAQ composite index for the over-the-counter market closed at 358.00, down 3.19.

Bond Prices Steady

In the credit markets, bond prices were little changed.

The bellwether 30-year U.S. Treasury bond rose 3/32 point, with the yield unchanged at 7.59%.

Analysts said trading was light to moderate, with most investors waiting for a flurry of economic reports due out today before getting heavily into the market.

In secondary market trading of Treasury issues, prices of short-term governments and intermediate issues were unchanged while 30-year issues were up 3/32 point, according to the investment firm of Salomon Bros. The movement of a point is equivalent to a change of $10 in the price of a bond with a $1,000 face value.

In corporate trading, industrials were unchanged and utilities rose point in light trading. Among tax-exempt municipal bonds, general obligations rose point in moderate trading and revenue bonds were unchanged in light dealings.

Yields on three-month Treasury bills were off 3 basis points to 5.34%. Six-month bills fell 4 basis point to 5.45%. One-year bills were off 1 basis point at 5.53%. A basis point is one-hundredth of a percentage point.

The federal funds rate, the interest on overnight loans between banks, traded at 5.8125%, down from 5.3125% on Wednesday.