Despite a sharp rise in housing costs, consumer price inflation stayed in single digits last month at a seasonally adjusted annual rate of 8.8 percent, the Labor Department reported yesterday.

High interest rates sent the housing component of the index soaring, but the adjusted increase inJune was 0.7 percent. The 8.8 percent annual rate, which measures how much prices would rise in a year if they maintained the June pace, was hailed by White House spokesman Larry Speakes as confirming the "overall moderation ininflationary pressures, which is bringing a measure of welcome relief to American consumers."

Figures published Wednesday showed a sharp slowdown in inflation between the first and second quarters of this year. Private economist Allen Sinai of Data Resources Inc. commented yesterday, "We're not out of the woods yet, but we're basically on track to single-digit inflation."

The June increase matched the 0.7 percent monthly rise in May, and compared with an increase of 0.4 percent in April and 0.6 percent in March. The downward pressure on fuel prices from the present oil glut has been one important factor holding down prices.

Gasoline prices fell by 1.5 percent in June. Fuel oil prices were also off slightly, but natural gas prices rose a little.

Lower-than-expected food prices also have been a major contributor to the inflation slowdown. In June, food and beverage prices rose only 0.2 percent after dropping by 0.2 percent in May. Some experts have been predicting a sharp rise in meat prices, but so far this has not materialized.

The June jump in housing costs accounted for three-quarters of the overall rise in consumer prices, the Labor Department said. Many economists believe the housing component exaggerates the inflationary effect of changes in home loan rates. Rising interest rates in both May and June translated into a big increase in the overall measure of housing costs.

Medical costs also rose substantially in June, for the sixth consecutive month, the report showed. The rise last month was 1 percent, composed of a 0.7 percent increase in physicians' fees and 1.4 percent rise in hospital room charges.

Transportation costs rose by 0.3 percent in June. Lower gasoline prices helped to offset sharp rises in car finance charges, new and used car prices and the cost of public transportation the report said.

In the three months ended in June, consumer prices rose by 7.4 percent, compared with a peak of more than 17 percent in the spring of last year.

The unadjusted consumer price index for all urban consumers stood at 271.3 in June, with 1967 as the base of 100, the Labor report showed.

Administration officials say the improvement in inflation is a result of their money and fiscal policy, although some outside economists believe it is partly luck, too.

A separate report yesterday showed the purchasing power of an average hour's earnings dropped by 0.2 percent last month. The hourly earnings index, adjusted for changes in overtime inmanufacturing and shifts between industries, was down 0.6 percent, in real terms, from a year earlier.

The average real spendable earnings, after Social Security and federal income taxes, of a married worker with three dependents dropped by 0.2 percent in May after seasonal adjustment. Over the year this measure has fallen by 2 percent, the Labor Department said.