NEW YORK—A New York primary that once looked like a sure thing for Hillary Clinton looms as a pivotal showdown in the Democratic presidential race, with rival Bernie Sanders hoping to embarrass her in her adopted state with a strong showing that would raise doubts about her electability.

Both campaigns see New York as a prize with one of two potential outcomes: A Clinton victory that deprives Mr. Sanders of one of his best remaining...