Gilbert Goldhammer, 72, a former enforcement official for the Food and Drug Administration and a congressional consultant who helped initiate some of this country's major investigations of suspected food and drug violations, died of cancer July 31 at the Washington Hospital Center.

Mr. Goldhammer, a chemist and an authority on food and rug law earned a reputation as one of the FDA's ablest officials during his 30-year career there. He directed investigations ranging from tainted meat cases to medical quackery, particularly with regard to suspicious cancer cures and other potential hazards, such as the lead content of vermont maple syrup. He retired in 1965.

For the last 11 years, he had been a consultant to the House intergovernmental relations and human resources subcommittee, which oversees operations of the Department of Health and Human Services and its component, the Food and Drug Administration.

His investigations for the subcommittee of intrauterine birth control devices was credited with laying the foundation for passage of the Medical Device Safety yact in 1976, and his work on the possible connection between chemicals and human cancers helped pave the way for drug law reforms in that area.

Shortly after joining the subcommittee in 1970, Mr. Goldhammer began investigating the use of diethylstilbestrol (DES), a synthetic hormone used as a fattening agent in poultry and cattle. Researchers at the University of Chicago associated it with vaginal and cervical cancer in daughters of women who took the drug during pregnancy to prevent miscarriages. The FDA banned use of the drug in animal feed in 1979.

Also while working for the subcommittee, Mr. Goldhammer investigated the connection between processed meat products and the formation of nitrosamines, potent cancer-causing compounds, in humans.

His work for the FDA, where he was assistant for regulatory operations before retiring, involved investigations of the alleged Hoxsey and Krebiozen cancer cures. In the case of Harry Hoxsey, a Texas cancer clinic operator, the FDA issued 46,000 posters to post offices and substations around the country warning the public that the medicine was worthless. It also banned the drug Krebiozen, also found to be worthless as a cancer cure, from interstate shipment.

Mr. Goldhammer was born in Brooklyn, N.Y., and earned a bachelor's degree in chemistry form City College of New York. He taught chemistry in New York City public high schools before joining the FDA in 1935.

After retiring and before joining the House subcommittee, he worked as a full-time consultant for the FDA for several years, preparing courses and conducting seminars on food and drug law for FDA officers, chemists, inspectors, physicians and others. He also was an adjunct professor in chemistry at Montgomery College.

A Washington resident, Mr. Goldhammer was one of the organizers and a former president of the North Portal Civic League here and a member of the executive board of the D.C. Federation of Civic Associations. He was a member of the American Chemical Society, the Association of Food and Drug Officers of the United States and the American Association of Analytical Chemists.

In addition, he was a member of the Kennedy Lodge of B'nai B'rith.

Mr. Goldhammer was the author of many technical papers in his field.

Survivors include his wife, Margaret M., of Washington; two daughters, Marian D. Hatton of Silver Spring, Md., and Martha R. Hillman of Calgary, Alberta; three sisters and a brother, four grandchildren and three great-grandchildren.