The cost of the so-called necessities - energy, housing, food and medical care -soared during the second quarter of this year three times as fast as prices for all other items measured by the Consumer Price Index, an economic research group reported today.

During the three months ending in June, seasonally adjusted prices for those four "basic necessities" rose at an annual rate of 18.6 percent, the National Center for Economic Alternatives reported. Prices of all other goods checked by the government for the CPI rose at an annual rate of only 5.3 percent.

"This is the highest rate of inflation we have seen in more than four years of monitoring necessity sector prices," said codirectors Gar Alperovitz and Jeff Faux in releasing the figures. "Consumers are still being hit hardest where it hurts the most in the items they cannot do without."

The four items measured by the Center's Basic Necessities Index represent roughly 60-70 percent of the household budget of four out of five American families, they said.

The largest single boost came in the area of energy prices, although the center pointed out that these figures deal with data collected before the latest OPEC price rise and before President Carter's decontrol of crude oil prices began to take effect.

Energy prices jumped at an annual rate of 64.2 percent during the second quarter, a 157 percent increase over the rate of energy inflation in the preceding three months, and a more than 700 percent increase over 1978's rate of energy inflation.

The energy situation is expected to worsen because of decontrol, the two economists added. "Heating oil is going to be a disaster area for inflation this winter," they predicted.

Housing costs rose at an annual rate of 15.9 percent during the second quarter, up 11 percent from the first quarter, of the year and 38 percent from 1978, the Center reported.

Food price increases slowed, however. Up an annual rate of 7.5 percent during the second quarter, food prices had been rising at an annual rate of 17.7 percent during the first quarter. They were up 11.8 percent in 1978.

Medical care price increases also slowed during the second quarter, rising at an annual rate of 7.7 percent. During the first quarter, medical costs had been going up at a 9.4 percent annual rate, while in 1978 they were up 8.8 percent.

The overall Necessities Index showed that the prices of the four items were rising 14 percent faster during the second quarter than they did during the first, when they were up a 16.3 percent annual rate.

Those prices were also rising 72 percent faster than they were last year, when they increased by 10.2 percent.

The price increases of "non-necessities" - all other CPI items - were at the same time slowing, the center reported. The 5.3 percent annualized increase during the second quarter was down 32 percent from the first quarter rate of 7.8 percent and down 18 percent from the1978 increase of 6.4 percent in that area.

"Until the administration moves to control inflation where it hurts the most - in the necessity sectors - we are unlikely to see a magnificant reduction in the overall inflation problem," the two economists concluded.