Andrew K. Ramsay, 68, a petroleum engineer with the Department of the Army who retired in 1972 after 30 years of government service, died Tuesday at the Circle Terrace Hospital in Alexandria. He had suffered from anemia for the past two years.

Mr. Ramsay was born in Hattiesburg, Miss. He earned a bachelor's degree in chemistry from Mississippi State in 1932 and a degree in petroleum engineering from the University of Oklahoma in 1940.

He came to Washington in 1942 from Hattiesburg, where he had been a chemical engineer, and was employed by the Navy as a petroleum engineer. He later switched to the Department of the Army.

For the past three years he had been a voluntary worker in the information office of the Arlington County school system. In 1977 he received a certificate of appreciation for this work as an "outstanding" volunteer and this year he received a letter of appreciation from the Arlington School Board.

He was a member of the Fairlington United Methodist Church and for several years had helped count the Sunday collections.

Survivors include his wife, Bernice, of the home in Alexandria, two sons, Andrew K. III, of Fairfax, and Thomas B., of Phoenix, Ariz., and two grandchildren.