Sen. Bernie Sanders reversed his opposition on reparations Friday and endorsed federal legislation to study the issue, which has taken center stage in the early scramble for the Democratic presidential nomination.

“If the House and Senate pass that bill, of course I would sign it,” said Sanders at Al Sharpton’s annual conference in Midtown.

“I would say this, there needs to be a study.

“But let me also say this, that I think what we need to do — and [Rep.] Jim Clyburn of South Carolina has talked about this — is to pay real attention to the most distressed communities in America,” he added.

That’s a shift from his previous dismissive comments about reparations last month.

“I think that right now, our job is to address the crises facing the American people and our communities, and I think there are better ways to do that than just writing out a check,” he told ABC’s “The View” on March 1.

Sanders made his latest comments as the second presidential hopeful to speak at Sharpton’s conference.

The Vermont lawmaker followed California Sen. Kamala Harris, another top-tier 2020 Democratic candidate, who led off the day.