In heavy boots and a hard hat, paleontologist Jim Walker ambled down a rocky slope and stopped.

“Look here,” he said, pointing to a shiny black shape in the sandstone. “This is one of its incisor teeth. They had short legs and a snout, kind of like a hippo or a manatee.”

Walker and construction crews building a new 220-foot-high dam at Calaveras Reservoir in the remote canyons east of Milpitas have been digging up a prehistoric treasure trove: the teeth of an extinct hippopotamus-like creature called a Desmostylus, clams, barnacles and the giant teeth from a 40-foot-long shark — and what could turn out to be an entire whale skeleton.

The discoveries are revealing what Silicon Valley looked like 20 million years ago during the Miocene Epoch, when the ocean extended as far inland as Bakersfield.

“This area used to be the beach,” Walker said, gazing around at the dry, pastoral landscape as dump trucks and bulldozers rolled nearby. “Twenty million years ago, this would have looked like Half Moon Bay.”

Over millennia, the world’s oceans have expanded and contracted with ice ages and warmer climates. The creatures that died sunk to the bottom and became fossilized and have shifted around because of California’s seismic activity.

“We started finding fossils here before construction even started,” Walker said. “It was exciting. We were finding scallops, and I said, ‘I want to get a whale.’ And we did.”

Since 2011, when work on the project began, crews have found nine whale skulls, to be exact. They have inventoried 529 types of fossils altogether. Of those, 168 are vertebrates, such as sharks; 267 are invertebrates, such as scallops — some as big as dinner plates. Thirty-nine 39 are plants, such as fossilized pine cones; and 55 are other ancient items, from animal tracks to burrows.

“Whales like this have been found in the Bay Area before,” he said. “But not this many together.”

Because of the heavy construction work, the site is closed to the public. But the fossils eventually will end up in a still-undetermined Bay Area museum, according to officials from the San Francisco Public Utilities Commission, which is building the dam.

Because of state and federal laws, paleontologists will continue working side-by-side with construction workers for the next two or three years on the massive job.

The plan is replace the old 210-foot Calaveras Dam, built in 1925, with a more earthquake-proof one by 2018 as part of a 15-year, $4.6 billion upgrade of the Hetch Hetchy water system.

“We’re prepping right now for the dam construction,” said project manager Susan Hou. “It’s like prepping when you paint a house. We need to remove the loose materials so the dam can be built on bedrock.”

So far, crews have dug what amounts to a 500-foot hole in front of the old dam. They have moved 5 million cubic yards of earth — enough to fill 500,000 dump trucks. They are about 60 percent finished with the job.

Originally, the project was supposed to cost $409 million and be finished next year. However, workers unearthed two huge ancient landslides. That required them to remove a huge amount of material to make the dam construction safe.

It added three years to the job and increased the cost to $700 million. But it also turned up more fossils.

Calaveras Reservoir is the largest of five reservoirs in the Bay Area that are part of the Hetch Hetchy system, a key part of the drinking water supply for 2.6 million residents.

When it was built, Calaveras Dam was the tallest earth-fill dam in the world, an engineering marvel that created a lake three miles long. But in 2001, the state Division of Safety of Dams declared it seismically unsafe.

If the dam collapsed during a large earthquake on the nearby Calaveras Fault, it would send a 30-foot-high wall of water rushing into Fremont and toward Interstate 880, studies showed. Such an event could kill thousands of people.

Because of the threat, the state ordered the reservoir drained to 40 percent of capacity, losing enough water to meet the needs of 300,000 residents a year.

The new dam, scheduled to start construction in 2016, will be the same size as the old one. It will be built about 400 yards downstream on Calaveras Creek. Its base will be a quarter-mile thick, made with earth and rock quarried from the reservoir site and tightly compacted.

When finished, crews will carve a large notch in the old dam, allowing the reservoir to pour in behind the new one. The old dam will be left in place, looking like a peninsula of land sticking into the 96,000-acre-foot reservoir.

On a recent blazing hot day, Walker chipped away at a hillside, showing the backbone of a 40-foot baleen whale. Over the next several months, more will be revealed as Walker and another paleontologist, Bruce Hanson, dig it out.

Over the years, Walker has found bison bones in Fremont and mammoth bones in San Francisco.

“But this is the most interesting stuff,” he said, smiling.

Paul Rogers covers resources and environmental issues. Contact him at 408-920-5045. Follow him at Twitter.com/PaulRogersSJMN.