Wholesale prices rose 0.4 percent last month as the effect of the summer's drought pushed up food costs for the first time in four months.

The August Producer Price Index released yesterday by the Labor Department appears to signal an end to the food price moderation the nation has enjoyed since early spring.

The Labor Department reported that prices at the bottom of the food chain for such items as grains and other staples shot up nearly 4 percent in August, largely the result of crop shortages created by the drought. Economists said yesterday that grocery store shoppers will begin to see higher food costs this fall and winter as these increases are incorporated in the prices of finished goods.

The future price impact of the drought will be in sharp contrast with that of recent months, when meat prices dropped because farmers were forced to slaughter hogs and cattle after the drought had dried up their feed. Labor Department economist Andrew Clem said that meat prices will be rising along with other food costs in the months ahead as supplies become scarce.

Despite the gloomier outlook for food prices, White House spokesman Larry Speakes said yesterday the producer price report was "still in line with our inflation forecast for the year." The administration expects inflation this year to be about 4.5 percent.

The Producer Price Index for all finished goods, whose changes are reflected somewhat later in prices at the consumer level, has been flat since the recession began and rose by only 0.1 percent in July. It had risen 3.7 percent for all of last year. Wholesale prices rises were at their lowest level in 16 years during the 12 months ended in August.

Economists said the food price increases will come slightly faster than higher costs in general and push the inflation level up somewhat. But because some costs of other goods have moderated, inflation shouldn't rise violently.

"There should be no virulent outbreak of inflation," said economist Andrew Brimmer. Energy price increases have slowed, he said, and "there's no evidence of an outburst of inflation in energy prices."

The increase in the index will probably produce a small rise in inflation, Clem said. "There's still a lot of uncertainty. There should be a small upward increase in inflation but you can't guess the total effect."

Vegetable prices at the supermarket have already begun to rise, Clem said, because those foods "go directly from field to the grocery store." He said the vegetables most affected were potatoes, onions, lettuce and cabbage, and poultry will also become more expensive because chickens lost weight and others died because of the heat.

Final food prices had fallen 0.6 percent in June and also in July.

Prices for raw materials jumped 2.1 percent in August compared with declines of 1.2 percent in July, a drop of 0.1 percent in June and no change in May. These prices usually decline during a recession and perk up when economic activity accelerates such as in the second quarter when GNP growth was 9.2 percent.

Vegetable prices rose 16.5 percent in August, compared with an increase in July of 11.9 percent. Poultry prices jumped 5.1 percent after falling by 2 percent the previous month. The effect of the heat on chickens caused egg prices to rise 4.4 percent after dropping 1.4 percent in July.

Pork prices rose 0.6 percent although prices for beef and veal fell 1.3 percent. However, beef and veal prices dropped 4.8 percent in July.

Wholesale prices for fruit fell 5.6 percent.

In nonfood areas, energy prices rose 0.3 percent in August, slightly above the 0.2 percent rise in July. Gasoline prices were up 0.4 percent, compared with the 0.9 percent rise in July. Natural gas prices dropped 0.2 percent after a 1.2 percent decline the previous month. Prices for heating oil increased 0.5 percent after falling 0.7 percent the month before.

Passenger car prices rose 1.3 percent after remaining flat in July, and light truck prices edged up 0.3 percent after falling 0.3 percent the month before. Capital equipment costs also rose 0.7 percent, the sharpest rise since November 1981, largely because of higher motor vehicle prices, the Labor Department said.