Two Reagan administration agency heads who are known for their loyalty to the president are nevertheless sharply challenging budget cuts and program rearrangements ordered by the Office of Management and Budget at the president's behest.

They are Health and Human Services Secretary Richard S. Schweiker and Environmental Protection Agency Administrator Anne M. Gorsuch.

Their appeals are symptomatic of problems President Reagan is likely to face in his Cabinet as well as on Capitol Hill as he presses for cuts in domestic spending on top of the large ones already made in the past two years.

Reagan, seeking to protect both his proposed military buildup and the third year of his tax cut, has said he will rely on cuts in domestic programs to hold down the looming federal deficit.

OMB Director David A. Stockman, in a first round of decisions on the fiscal 1984 budget that will go to Congress early next year, has ordered program cuts consistent with a $25 billion to $30 billion eventual decrease in domestic spending. Agency heads can appeal these decisions, to Stockman, then to Reagan.

Schweiker, in a confidential letter of protest to Stockman dated Nov. 29, objected to "drastic" reductions in personnel for the Social Security Administration, which would lose 5,000 people and be limited to 79,500, and the Health Care Financing Administration, which would be allowed only 3,800 people instead of Schweiker's proposed 4,483.

The secretary declared that these cuts would impair HHS's control over the "vast entitlement programs" under its jurisdiction, such as Social Security, Medicare and welfare. He also strongly objected to health program cuts and Head Start changes.

Gorsuch reportedly plans to appeal almost all elements of the OMB's 11 percent cut in the agency's $974 million operating budget request, in large part because she feels reallocations of money and personnel within the agency trespass on her prerogatives as administrator.

The $974 million request represented a $66 million cut in the agency's current budget, sources said.

The research and development budget alone would be cut by $51 million, or 22 percent between fiscal years 1983 and 1984 if OMB's cuts are retained by Reagan and Congress, according to sources familiar with the figures.

Last year Congress gave the agency $226 million in research funds, or $7 million more than it requested. This year EPA proposed a $222 million research budget, which OMB cut to $175 million.

Of smaller significance in budget terms but great significance politically are sharp OMB cuts in the regulatory and enforcement personnel for the Safe Drinking Water Act and substantial cuts in the office monitoring hazardous-wastes dumping sites.

Both programs command strong congressional support, but there is strong sentiment within EPA and elsewhere in the administration that the drinking water regulation is more properly a state function.

While cutting the agency's operating budget by about $100 million, OMB added $400 million to EPA's proposed $2 billion in expenditures for construction of local sewage treatment plants around the country.

Almost all of this money would go to plants already on the drawing boards.

The administration pledged to Congress that at least $2.4 billion would be spent on sewage construction for the next four years if the lawmakers agreed to amendments in the rules governing this construction.

The Schweiker letter to Stockman said cuts in the Centers for Disease Control, Food and Drug Administration and several health policy research units would "seriously impede their ability to carry out efforts needed to protect the public health."

He said Stockman's plans to dissolve the Alcohol, Drug Abuse and Mental Health Administration and cut the functions of HHS's assistant secretary for health were totally ill-advised and in any event should not be handled in the budget context.

Schweiker said the loss of 11,000 full-time jobs in his department, including the Social Security and HCFA cuts and a reduction of the secretary's own direct staff from 4,000 to 3,000, would cause "massive disruption."

Cuts amounting to 60 percent in nonbiomedical research, Schweiker said, reflected "profound misunderstanding" of such research and undermine efforts at policy formulation.

Asked for comment on the letter, Schweiker's public affairs aide, Pamela G. Bailey, said, "I refuse to comment. It is Secretary Schweiker's policy not to reveal anything having to do with the budget."

Schweiker's letter also objected to cuts: wiping out plans for 5,000 new health research grants, in the budget for St. Elizabeths Hospital of 22 percent (saying it would jeopardize the hospital's accreditation), in the Indian Health Service, in the health education and health service corps, and in the smoking and health and health promotion programs.

According to Bill Drayton, head of Save EPA and a former assistant EPA administrator in the Carter administration, OMB's proposal for the environmental agency would cut purchasing power more than 40 percent in three years.

"Every year there's more pollution, especially more toxic pollution, and we're now committed to a decade of incapacity in environmental management," Drayton said.