A border collie that fell more than 15 feet into a drain at a Mount Sinai golf course was rescued after being missing five days, officials said.

James Brown, a 2-year-old border collie who’s affectionately known as JB, was last seen chasing geese off the Willow Creek Golf and Country Club on July 10 when club employees reported him missing, Suffolk County SPCA Chief Roy Gross said.

Employees searched for the dog, who lives at the course and is trained to chase geese, but the pup was “nowhere to be found,” Willow Creek mechanic Matt Geib said.

Last Saturday, a golfer heard whimpering from a drain that feeds into a pond on the course, Geib said. An employee lifted a manhole cover to look for JB and could hear the dog crying from another pipe.

Golf course personnel used shovels and a backhoe to dig near the pipe and called the SPCA and Suffolk County Emergency Services Unit for assistance, according to Gross.

“Everyone was nervous,” Gross said. “It was like we were trying to save a miner trapped in a mine.”

Eventually crews found another opening. An emergency service officer climbed down more than 15 feet and was met by JB, Gross said.

advertisement | advertise on newsday

“It was a miracle to see this dog coming out alive,” Gross said.

The border collie was dehydrated and had lost a couple pounds, but had no other injuries, Gross said.

“We gave him a nice bath and fed him until he couldn’t eat anymore,” Geib said. “Later that day, he grabbed his ball and wanted to start playing again.”