Wholesale prices one step short of retail rose a moderate 0.4 percent in June, the government said Friday. But the drought searing much of the nation sent prices for raw food soaring at their steepest pace in more than 21/2 years.

The Labor Department said raw food costs jumped 4.2 percent last month, a rate not seen since October 1985. Further along in the wholesale process, however, prices for foods ready to be retailed rose 1.1 percent, reflecting earlier, though less severe, increases in raw food costs.Some examples of price increases at the unprocessed-food level: wheat, 25.3 percent; corn, 24.3 percent; turkeys, 22.8 percent; soybeans 22 percent; chickens, 22.5 percent.

Reflecting the fact that many farmers are slaughtering animals they cannot afford or find feed for, cattle prices fell 5.2 percent while hog pries were down 4.0 percent.

The news was not quite so severe at the finished-goods level. Prices for eggs rose 16.0 percent while turkey prices gained 9.3 percent, chicken prices jumped 7.3 percent and fresh fruit costs gained 6.7 percent.

Those gains were partially offset by a 5.7 percent decline in vegetable prices and a 2.2 percent decrease for rice.

Energy prices, meanwhile, fell at the finished level by 1.6 percent. Leading the way was a drop of 7.1 percent for fuel oil while declines of 2.4 percent and 1.0 percent were posted for gasoline and natural gas, respectively.

Further energy price declines are considered likely because crude oil prices have fallen over the last month to their lowest levels in nearly two years.

Overall, if the June increase in finished goods prices held for 12 straight months, the inflation rate would be 4.6 percent annually, more than double the 2.2 percent rise of 1987.

Subtracting the effects of volatile food and energy prices, wholesale prices rose 0.3 percent last month.

Analysts consider this rate a better indication of the economy's underlying inflation. Even with steep food price gains anticipated for the next several months, many economists feel the effect of those gains will be only temporary.

For the first half of 1988, prices one step short of retail rose at a seasonally adjusted annual rate of 3.6 percent. Excluding food and energy prices, wholesale costs rose 4 percent over that period.