Dr. William John Gruver, 71, a retired official of the U.S. Department of Education and a former teacher and vice principal in the Montgomery County school system, died May 26 at J.C. Blair Memorial Hospital in Huntington, Pa., after a heart attack. He was stricken at his home in Newton Hamilton, Pa.

Dr. Gruver moved to the Washington area in 1948 and taught chemistry and biology in the Montgomery County schools. He later was vice principal of Poolesville High and Wheaton High.

In 1958, he joined the old U.S. Office of Education as a program specialist. Much of his work concerned special programs to teach science. He retired from the Department of Education in 1981.

A former resident of Gaithersburg and Hyattstown, Md., he moved to Newton Hamilton when he retired.

Dr. Gruver was born in Bloomsburg, Pa. He graduated from Pennsylvania State University. He received a master's degree in education at Harvard University and a doctorate in education at George Washington University.

He was a past president of Phi Delta Kappa, a professional education association.

His marriage to Betty Ball Gruver ended in divorce.

Survivors include his wife, Miriam Gruver of Maurertown, Va., and their daughter, Donna Merrill Gruver of New York City; three daughters by his first marriage, Mary Lee Phelps of Clarksburg, Md., Ann Barnard of St. Thomas, V.I., and Bettina Smith of Nashua, N.H.; three sons by his first marriage, William John Jr., of Derwood, Md., Andrew, of Baltimore and Michael, of Taberg, N.Y.; one sister, Patricia Bailey of Lewistown, Pa., and seven grandchildren.