WASHINGTON — The Supreme Court entered the latest battleground in the culture wars on Tuesday, hearing arguments in a hard-fought clash between gay rights and claims of religious freedom that was a sort of sequel to the court’s 2015 decision establishing a constitutional right to same-sex marriage.

The new case involves the refusal of a Colorado baker, Jack Phillips, to make a wedding cake for a gay couple, and it had some justices worried that a ruling in his favor would undermine the 2015 decision’s promise of equality. But other justices said that a tolerant society must leave room for good-faith dissent based on religious principles.

Justice Anthony M. Kennedy, who almost certainly holds the crucial vote in the case, said both things.

He asked whether a baker could put a sign in his window saying, “We do not bake cakes for gay weddings.” A lawyer for the Trump administration, which supports Mr. Phillips, said yes, so long as the cakes were custom made.