Dr. John Hilton Knowles, 52, president of the Rockefeller Foundation and a well known and sometimes outspoken medical administrator, died Tuesday at Massachusetts General Hospital in Boston. He had cancer of the pancreas.

Dr. Knowles had headed the $800 million Rockefeller Foundation since 1972, and had sought to expand its activities in agricultural development and international relations. Before taking that position, he had been for 10 years the general director of Massachusetts General, an institution with which he was associated for 20 years. He was the youngest director in the hospital's history.

In 1969, it was expected that Dr. Knowles would be nominated by then president Richard Nixon to be assistant secretary of Health, Education and Welfare for health and scientific affairs. The nomination never was made because of opposition from the American Medical Political action Committee and some quarters of the Merican Medical Association.

The apparent reason for this opposition was the fact that Dr. Knowles, a Nixon supporter, had called for improvements in Medicare and other national health programs. AMPAC, which had contributed heavily to Nixon's campaign opposed these plans.

As a physician and medical administrator, Dr. Knowles emphasized programs of preventive medicine. He also spoke out against unnecessary operations and exorbitant fees charged by some physicians. He once described the Medicare program as a "monument to the failure of the private sector to solve an obvious problem in the public interest."

He was a founder of the International Agriculture Development Service, which sponsors farm development in poorer parts of the world. The service's main support is the Rockefeller Foundation.

Dr. Knowles was born in Chicago. He grew up in Normandy, Mo., and Belmont, Mass. While an undergraduate at Harvard, he and Jack Lemmon, the actor, who was a classmate, played four-handed piano on the radio and at a nightspot in the old tawdry Scollay Square area of Boston.

Having graduated from Harvard College, Dr. Knowles applied to the Harvard Medical School. His application was turned down.He eventually was admitted to the medical school of Washington University in St. Louis, and graduated at the head of his class in 1951.

Dr. Knowles returned to Boston and began his long accociation with Massachusetts General as an intern. He also taught at Harvard Medical School. At the time of his death he was a professor of medicine at New York University.

Dr. Knowles's publications included "Respiratory Physiology and its Clinical Application" (1959), and "Doing Better and Feeling Worse: Health in the United States" (1977).

At the end of his entry in "Who's Who," he included the following statement, "I believe in hard work, self-reliance and the promise of America, upward mobility through education and sustained effort. A sense of humor is the prelude to faith and laughter is the beginning of prayer."

Survivors include his wife, the former Edith Morris LaCroix, of the homes in New York and Massachusetts; six children, Edith, John, Charles, James, Jean, and Robert; a brother, James T., of Pomona, Calif., and his mother, Mrs. James Knowles Jr., of St. Louis.