Ralph Lee Hill, 51, a stockbroker, investment counselor and former president of a vending machine company who played a role in the downfall of Robert G. (Bobby) Baker, a onetime secretary of the U.S. Senate Majority, died of cancer Sunday at George Washington University Hospital. m

In 1963, when he was president and part-owner of the Capitol Vending Co., Mr. Hill filed a civil suit against Baker claiming $300,000 in damages. The suit contended that Baker had accepted monthly payments to ensure that Capitol machines served Melpar Inc., a suburban Washington defense contractor. In fact, the suit claimed, Capitol's contract with Melpar was canceled and its machines were replaced by those of a firm in which Baker owned an interest.

The suit was settled out of court for $30,000. But it led former Sen. Mike Mansfield (D-Mont.), then the Senate majority leader, to question Baker about his outside business activities. Baker, who was a protege of Lyndon B. Johnson, resigned his powerful Senate post. The ensuing Senate investigation of Baker's activities, in which Mr. Hill testified, led to Baker's eventual conviction and imprisonment on criminal charges.

Mr. Hill sold his interest in Capitol Vending late in 1963 and became a real estate and investment counselor. In 1969, he became a stockholder. For the past 10 years, he had specialized in institutional investments and was associated with Dean Witter Reynolds Inc. at the time of his death.

A native of South Carolina, Mr. Hill attended the University of South Carolina. He was active in alumni affairs and helped raise funds for the university's football stadium and its medical school.

He served in the Air Force from 1948 to 1951 and then moved to Washington, where he became president of Capitol Vending.

Mr. Hill was a member of the Congressional Country Club and had won several amateur golf tournaments.

Survivors include his wife, Sonja Hillgren Hill, of Washington; his mother, Mary Hill, of Green Sea, S.C.; a brother, Raleigh, also of Green Sea, and two sisters, Jewel Huggins, of North Myrtle Beach, S.C., and Christine Phillips, of Lamar, S.C.

The family suggests that expressions of sympathy be in the form of contributions to the Ralph L. Hill Meical Research Fund at the University of South Carolina College of Medicine.