David E. Bayliss Jr., 71, a retired civil engineer who had worked for both the federal government and the District of Columbia, died of cancer Monday at Circle Terrace Hospital in Alexandria. He lived in Alexandria.

Mr. Bayliss was a native of Alexandria and a graduate of Alexandria High School. He attended George Washington University and the University of Virginia. He was an Army combat engineer in Europe and North Africa during World War II, and was discharged as a lieutenant colonel in 1946.

After the war, he worked for the old Federal Works Agency, General Services Administration, and Navy Department before joining the District government about 1960. He retired in 1972 as inspection division chief of the Buildings and Grounds Department's municipal architect's office. After that, he was a private engineering consultant.

Mr. Bayliss was active in Masonic organizations. He was a past-master of the Alexandria-Washington Masonic Lodge, member of Kena Temple and the Scottish Rite and a past-commander of the Grand Commandry of Virginia. He also was a life member of the Veterans of Foreign Wars Post No. 609, and past-president of the Mt. Vernon Lions Club.

His wife, Elizabeth Duncan Bayliss, died in May 1981. Mr. Bayliss' survivors include two daughters, Marlene B. Conner of Colonial Beach, and Patrisia B. Owens of Alexandria; his parents, Mr. and Mrs. David E. Bayliss Sr., of Alexandria; a sister, Catherine B. Otley of Melbourne, Fla., and two grandchildren.