The economy expanded at a brisk annual rate of 3.3 percent from April through June despite a severe shock from the drought that seared much of the country, the government reported Thursday.

The gross national product, the broadest measure of economic health, expanded at essentially the same rate as in the first quarter, when the GNP rose at an annual rate of 3.4 percent.But inflation in the second quarter, the Commerce Department said, was accelerating at its fastest pace in almost six years.

The robust 3.3 percent growth rate occurred despite the fact that the impact of the drought on farm production shaved a full percentage point from second-quarter growth, the government said.

Without the drought, the GNP would have shot up at a 4.3 percent annual rate in the April-June period.

The government estimated that the drought will reduce farm output by $14.3 billion in 1988, trimming about 0.4 percentage point from growth for the full year.

Even with the troubles in the farm belt, however, the economy continued to show its resiliency, propelled by a sharp turnaround in the country's trade deficit and strong growth in business investment and consumer spending.

But inflation accelerated as well, with a GNP price index that measures a changing market basket of goods rising at an annual rate of 5.1 percent, the fastest increase since a 5.8 percent rise in the third quarter of 1982.

The big surge in inflation, which followed an increase of 1.7 percent in the first quarter, was blamed on higher consumer prices for clothing, food and gasoline.

The burst of inflation served to emphasize the problems facing the expansion, which has already lasted a peacetime rec-ord of 69 months.

With growth so robust, the economy is beginning to see rising inflationary pressures from tight labor markets and demand outstripping production.

The Federal Reserve since March has been pushing interest rates higher to dampen demand, but many economists are worried that unless growth slows in the coming quarters, the central bank will have to clamp down even harder.