For Andrew Dorsey, a pipe of layer for the Calcon Co. of Rockville, it was a routine job of hooking up sewer and water connections for a new home in Gaithersburg. But about 8.30a.m., when Dorsey stepped into a seven-foot hole that had been dug for the job, the muddy sides of the hole caved in on him.

For the next four hours, Dorsey remained trapped in the mud, which rose up to his neck like quicksand.

Fire rescue service workers from the Gaithersburg area as well as employes of the Washington Gas Light Co. and the Washington Suburban Sanitary Commission, which had contracted with Calcon to do the sewer hooked-up, arrived immediately and worked to shore up the hole with wooden planks and pull Dorsey out with a rope.

TV camera crews also arrived, and they and several police officers, reporters, rescue workers and local youths looked on as Dorsey grimaced and groaned in the hole, complaining of pain in his right leg and ankle. Rescue workers also feared that he had suffered a fractured arm.

During the rescue attempt, Dorsey was given fluids intravenously and supplied with oxygen through a mask. Rescue workers said an underground stream near the hole exerted suction, pulling Dorsey farther into the mud.

Dorsey was freed at 12.30 p.m., barely able to walk, and was carried on a stretcher to a waiting ambulance. He was taken to Suburban Hospital where he was reported in good condition and a hospital spokesman said he suffered no fractures or broken bones.

After his ordeal, Dorsey, 21, who lives in West Friendship, Md., praised and thanked the half dozen men who risked going into the hole to save his life.

"I kept praying to God," for their safety and his own, Dorsey said.

The Maryland Occupational Safety and Health office is investigating the incident to determine whether there were any safety violations that may have contributed to the accident.