Andrew A. Rivett, 52, a retired Navy chief petty officer and a civilian budget analyst for the Department of Defense, died of cardiac arrest Monday at Fairfax Hospital.

During this 20-year career, Mr. Rivett served aboard ships in the Atlantic and Pacific fleets and at the Department of Defense. He also was supervisor of the personnel office at the Fleet Sonar School in Key West and served on the staff of the Industrial College of the Armed Forces here. aHis last assignment before retiring in 1964 was as chief clerk in the military personnel branch in the Office of the Secretary of Defense.

Mr. Rivett then became a civilian employe of the Defense Department and was a budget assistant secretary of defense at the time of his death.

He was born in Dansville, N.Y. A Fairfax resident, he attended Fairfax United Methodist Church and was a board member and past treasurer of the Rutherford Swimming Pool Club in Fairfax.

Survivors include his wife, Gwen, and two daughters, Karen and Kim, all of Fairfax; another daughter, Marcia Earhart of Cheverly; a son, Michael, of El Paso, Tex.; two stepchildren, Karen and Keith Wood of Fairfax; his father, Francis of Buffalo, N.Y.; his mother, Marion Johantgen, and a brother, Charles, both of Palm Bay, Fla.; a sister, Doris Denton of Dansville, and a grandaughter.

The family suggests that the expressions of sympathy be in the form of contributions to the Andy Rivett Memorial Fund at Fairfax United Methodist Church.