As 20 Democratic presidential candidates prepare to debate this week in Detroit, Sen. Kamala Harris has a narrow lead in a California survey that finds dramatic differences in the preferences of younger and older voters.

The poll, conducted by the Public Policy Institute of California, found Harris on top with 19% support from likely voters in the March 3 Democratic primary, just ahead of Massachusetts Sen. Elizabeth Warren with 15%, Vermont Sen. Bernie Sanders with 12% and former Vice President Joe Biden with 11%. Pete Buttigieg, mayor of South Bend, Ind., was the only other Democratic candidate to reach 5%.

The survey was an open-ended poll, with people asked to name the candidate they supported, rather than pick one from a long list. An open-ended national poll taken earlier this month by ABC News and the Washington Post found Biden on top at 25%, followed by Sanders at 18%, Harris and Warren at 9%, and Buttigieg at 3%.

Even though the California poll found that 70% of likely voters are paying close attention to the 2020 presidential race, the survey found that 25% of those surveyed haven’t decided whom to support.

“At this stage of the race, (the poll) gives a sense of who the front-runners are,” said Mark Baldassare, CEO and director of the poll and president of the institute. “You have four candidates on top and everyone else trailing, but there’s still a long way until March.”

The poll found that the age of the voters plays a huge role in Democrats’ choices.

Voters ages 18-44 gave Sanders the top spot at 21%, followed by Warren at 19%. Harris dropped to 13% while Biden virtually disappeared among younger voters, drawing only 4%. Buttigieg had 1%.

But Sanders took a beating among voters 45 and older, slipping to fourth place at 8%. Harris was in the lead at 22%, followed by Biden at 14%, Warren at 13% and Buttigieg at 7%.

“Biden certainly has work to do among younger voters,” Baldassare said. “This really shows the difference between younger and more progressive voters who may be more idealistic and older voters who may be more pragmatic” in looking for a candidate who can defeat President Trump.

Whoever wants the Democratic presidential nod is going to have to talk seriously about the environment. Ninety-four percent of likely Democratic voters said the candidates’ positions on environmental issues are important to their choice.

That’s a stark contrast with Republicans — 42% of those surveyed said their candidate’s stance on the environment was not too important.

That GOP indifference to environmental concerns is seen throughout the institute’s survey.

“It’s a hyperpartisan atmosphere when it comes to environmental issues,” Baldassare said. “There was a time when the environment was something Democrats and Republicans could agree on, but this is not that time.”

Asked whether global warming has contributed to recent wildfires, for example, 63% of all California adults said it had. But while 79% of Democrats and 61% of independent voters said there was a link between climate change and the fires, only 26% of Republicans agreed.

While two-thirds of California adults favored a state law calling for reduced greenhouse gas emissions by 2030, 58% of Republicans were opposed. A state call for all of California’s electricity to come from renewable sources by 2045? All adults, 71%. Republicans, 33%.

Asked if California should make its own policies, separate from the federal government, to fight climate change, the differences were dramatic: Among Democrats, 81% were in favor, compared with 28% of Republicans.

The poll was based on a telephone survey of 1,706 California adults, including 1,085 likely voters. It was taken July 14-23. The margin of error for all adults is 3.9 percentage points and 4.4 percentage points for likely voters.

John Wildermuth is a San Francisco Chronicle staff writer. Email: jwildermuth@sfchronicle.com Twitter: @jfwildermuth