Wholesale prices rose a relatively moderate 0.4 percent in May, their smallest jump in nine months, raising the possibility that inflation may be beginning to ease after months of exceptionally sharp price increases.

Although most of the improvement stemmed from a 1.3 percent plunge in farm and food prices, the increases for most nonfood items also slowed.

However, these gains were at least partly offset by sharply rising energy prices, both for petroleum products directly and from the so-called "ripple" effect of higher energy prices on the rest of the economy.

The wholesale price of gasoline soared 4.2 percent in May, while prices of home heating oil jumped 5.4 percent. Moreover, analysts said energy prices are likely to rise more rapidly in the months ahead.

The May figures were greeted warmly by the Carter administration. Treasury Secretary W. Michael Blumenthal called the improvement "the first bit of good news" on the inflation front and predicted retail prices would ease by fall.

Blumenthal also reiterated his view that "there still is no evidence that we are going into a recession," as some economists contend, and asserted that Carter would not "flinch" and seek to stimulate the economy if the slowdown continues.

"We needed a slowing-down of the economy to a more sustainable pace, and we are getting it . . . in the right way," the secretary told a luncheon group. He said Carter "will not be motivated by any short-term election-year" temptations.

The secretary also said Carter would not propose a tax cut until "he finds he has budgetary leeway and inflation" begins to slow down, even though inflation is pushing taxpayers into higher brackets.

And he said that when a tax cut is proposed, it probably will include new measures to spur business investment, such as faster depreciation writeoffs and possible eliminating the present "double" taxation of earnings and dividends.

The May rise in wholesale prices of 0.4 percent compared with increases of 0.9 percent in April, 1 percent in March and February, 1.3 percent in January and 1 percent in December. Until May, the index had been rising at a 13 percent annual rate.

However, analysts cautioned that it was still too early to tell precisely how much rising energy prices will offset any future gains. Besides the continued "ripple" effect, there's the probability oil producers will raise prices again.

The steep decline in wholesale food prices came in a wide variety of key staples. Wholesale prices of beef and veal plunged 6.9 percent, after soaring for five months.Pork prices plummeted by 10.1 percent.

However, sugar and coffee prices turned up again in May after declining in the previous month. And yesterday, the Folger Coffee Co., the nation's second largest coffee-roaster, raised its wholesale prices by 25 cents a pound.

Besides the decline in food prices, perhaps the most substantial sign that inflation finally may be slowing came in a modest improvement in nonfood prices other than energy - a key barometer of underlying inflation trends.

At the intermediate stage of the production process, these prices rose by 0.7 percent in May, compared with a 1.3 percent rise April. The slowdown at the finished-goods stage was less dramatic - a 0.6 percent rise, from 0.8 percent.

There also were some other improvements:

Prices of capital equipment, a key element in the previous inflation surge, rose a more moderate 0.7 percent in May, following a sharp 1.1 percent rise during April. These prices are a major factor in industry costs.

Prices of building materials, important in determining the cost of housing, also eased visibly across a wide variety of products. Millwork prices fell 2 percent in May, while plywood prices declined 0.9 percent.

Prices of iron and steel scrap, which helped fuel inflation in previous months, dipped sharply in May, falling 5 percent over the month. However, nonferrous scrap jumped another 1.5 percent.

May's slowing brought the pace of inflation at the wholesale level to an annual rate of 9.4 percent for the three-month period that ended in May - down from a 13.7 percent pace for the February-April period.

The index of producer prices, as the wholesale price index is now called, stood at 212.4 percent of its 1967 average. That means it took $212.40 to buy the same goods at wholesale in May that cost $100 just 12 years ago.

In his remarks to reporters yesterday, Blumenthal said he thinks inflation is bound to slow later this year because food prices already are on the wane and business activity "clearly is easing some."

His comments marked a full reversal from his stand five weeks ago, when the secretary - and chief Carter economist Charles L. Schultze - were trying to prod the Federal Reserve Board into raising interest rates to slow business activity. CAPTION: Graph, Wholesale Prices For Finished Goods, The Washington Post