In Margaret M. Heckler's 2 1/2 years as secretary of health and human services, the ex-GOP legislator from Massachusetts has often been far ahead of the White House in divining the most compassionate, and simultaneously politically effective, stance for the Reagan administration on controversial health and welfare issues.

But there is a widespread belief in both the White House and on Capitol Hill that her skills as an administrator of the massive agency were lacking. She was accused of failing to follow up her policy initiatives, of failing to delegate authority and of piling too many issues on her plate and then delaying decisions.

And Heckler's messy, fully publicized divorce from her husband, John, is said to have hurt her image with some of the president's closest advisers, including First Lady Nancy Reagan. Her feisty -- some said combative and temperamental style -- was said to irk chief of staff Donald T. Regan and be a major reason for new troubles.

Heckler's problems were not all of her making. Her efforts to speed important health and welfare regulations, some of which had been delayed for years, and to move things along on the administrative front were often hobbled by repeated attempts by the Office of Management and Budget to dictate HHS policy and to reverse tentative decisions made by Heckler.

At the same time, the White House held up for as long as two years in some cases the appointment of a large number of persons chosen by Heckler for key HHS positions. Sen. William Proxmire (D-Wis.) complained last Tuesday that nine of 17 major posts had no permanent appointee.

Appointed Jan. 12, 1983, with a reputation as a moderate-to-liberal Republican on social issues, a women's rights advocate and a foe of abortion, Heckler came to office at a time when the president was under sharp attack on the issue of "fairness" to the poor. Her charge was to run an agency whose programs were often under attack by the White House and a president skeptical of much social spending.

On a series of issues where the White House was moving slowly or not at all, Heckler tried to reverse that. She tried to create a sense of compassion and to reverse the administration's image on the "fairness" issue.

Long before the rest of the administration, she sensed that acquired immune deficiency syndrome (AIDS) was a major national health issue and not, as some conservatives were saying, a punishment visited on male homosexuals by providence. She proclaimed it the No. 1 national health issue requiring stepped-up research and control efforts.

Similarly, she singled out Alzheimer's Disease, the debilitating condition causing senility for special attention. Recently she has been planning a major initiative on breast cancer.

Working with female members of the House, both Republicans and Democrats, she correctly diagnosed the issue of child support by absent fathers as a women's issue that cut across the political and ideological spectrum. She won administration support for strong legislation on the issue.

In the massive dispute between Congress and the White House over Social Security disability policy, she argued early on for a policy of accommodation with Congress in making it harder to push people off the rolls.

She also favored Medicare aid to hospices and protection of the nation's medical research establishment. She has repeatedly supported initiatives to experiment with ways to care for the aged who need nursing home attention.

Coming to Heckler's defense last week, when she was under siege by White House officials, Sen. Orrin G. Hatch (R-Utah), chairman of the Senate Labor and Human Resources Committee, declared she had done an excellent job in running the $330 billion-a-year department, which has nearly all the government's major health, welfare and income support programs, including Social Security, Medicare, Medicaid and the public health service and National Institutes of Health.

"Heckler has done a terrific job . . . . She grabbed hold of the AIDS issue and made it the No. 1 health issue . . . . She saved $6 billion in Medicare alone" by work on new, tighter systems of payment, he said.

Dr. Sidney Wolfe, the outspoken director of the Public Citizen Health Research Group, has a different view, particularly on the secretary's role on food and drug regulation. "She's done an excellent job of serving the regulated industry, of pleasing the industry" instead of regulating it, he said in an interview.

Both from White House observers and those in industry and on Capitol Hill, the biggest criticism of Heckler was on matters of style and administration.

One knowledgeable lobbyist who asked not to be identified, said, "She was a political asset to the president but not very good administratively. She wouldn't delegate enough authority for decision-making. She tended to cut people out of the administrative loop."

Heckler, the lobbyist said, "also tried to handle too much herself in briefing the press or Cabinet on technically difficult areas where it wasn't necessary," rather than enlisting the help of more knowledgeable senior officials.

On Capitol Hill, one health expert said that one example of Heckler's lack of followup was the AIDS situation. Despite singling out AIDS as one of special initiatives, she either did not request increased funding or gave in too easily to budget-cutters, one official said.

In her defense, admirers point out that Heckler was frequently stymied by the OMB, which was seeking to cut the budget and save money. This happened on a number of issues -- Medicare regulations and rates, disability regulations, long-term care, research.

Several people familiar with Heckler and HHS said they think that Heckler's combative personality and possibly the fact that some considered her too liberal, may have contributed more toward the efforts by the White House to push her out than any specific failings as an administrator.

One GOP Capitol Hill aide said HHS has always been considered unmanageable. "Nobody has been able to bring that beast to heel."