Sterling E. Shelly, 59, a retired budget analyst with the Department of the Army who had lived in the Washington area since 1941, died of cancer Tuesday at Arlington Hospital.

Mr. Shelly worked for the Army for 31 years. He began his career as a civilian intelligene employe of the old War Department before World War II, served on active duty in Europe during the war, and then was a civilian employe until retiring in 1973. He spent his last 13 years as a budget analyst.

He was a native of Freeland, Pa., and lived in Washington for eight years before moving to Falls Church in 1949. He was a graduate of the MMI Preparatory School in Freeland and McCann's Business School in Hazelton, Pa. He attended Wake Forest College.

Mr. Shelly was a member of Holy Trinity Lutheran Church in Falls Church.

Survivors include his wife, Millie, of Falls Church; two sons, Gary, of Williamsburg, and Wayne, of Dallas; his father, Elmer S. Shelly of Freeland, and a sister, Lydia Goetter of Hatboro, Pa.

The family suggests that expressions os sympathy be in the form of contributions to Holy Trinity Lutheran Church in Falls Church, or to MMI Preparatory School, Freeland, Pa., 18224.