John Martin Kelly, 62, former assistant secretary of the Department of the Interior for mineral resources, died Monday at St. Mary's Hospital in Roswell, N.M., after a long illness.

He was appointed to the post in 1961 and served in the politically sensitive job of top government adviser on gas and oil until resigning in July, 1965.

Since then, Mr. Kelly had been a consultant on petroleum matters to private industry and the government.

He was a current member of the advisory committee to the U.S. delegate to the petroleum committee of the Organization for Economic Cooperation and Development in Paris, and also a member of the National Petroleum Council.

He had held both those positions since 1965, and divided his time between his offices in Roswell and Washington. Last year he was named to the Petroleum Natural Gas Advisory Committee of the Federal Energy Administration.

Born in Chelsea, Mass., Mr. Kelly received a bachelor's degree from the New Mexico School of Mines, where he also was certified as a petroleum engineer. He later received a doctorate from the New Mexico Institute of Mining and Technology.

He was associated with private industry from 1936 until 1941, when he became executive director of the New Mexico Oil Conservative Commission. Director of the New Mexico Bureau of Mines and Mineral Resources and state geologist of New Mexico.

He was president of the Elk Oil Co. In Roswell from 1945 until he was appointed to the Interior Department. During his tenure, he headed U.S. delegations to internation petroleum conferences in Tehran and Tokyo.

After he resigned as assistant secretary of the Interior, he continued to be a consultant to the Interior Secretary until 1969. He was awarded the department's Distinguished Service Gold Medal.

Mr. Kelly was a member of the American Institute of Mining Engineers, the American Association of Petroleum Geologists, the American Association of Petroleum Landmen, the American Institute of Professional Engineers, the American Petroleum Institute and the Independent Petroleum Association.

He is survived by his wife, Esther Landenberg Kelly, of the home in Roswell: two sons, Joseph James and John Michael, both of Roswell; two daughters, Patricia Elizabeth Kyle, of Richmond, Va., and Mary Ann Kelly.

The family suggests that expressions of sympathy may be in the form of contributions to the Cancer Research Fund at St. Mary's Hospital in Roswell.