The argument has met with little success in the lower courts. But the Supreme Court has in recent years been exceptionally receptive to free speech arguments, whether pressed by churches, corporations, pharmaceutical companies, musicians or funeral protesters. And it has ruled that the government may not compel people to convey messages that they do not believe.

It takes the votes of four justices to add a case to the Supreme Court’s docket, meaning at least that many thought Mr. Phillips’s case worthy of review. Earlier opinions suggest that the court will be closely divided in the case. The Trump administration, for its part, filed a brief urging the court to rule for Mr. Phillips on free speech grounds.

Mr. Craig said the free speech argument was a smoke screen. “It’s not about the cake,” he said. “It is about discrimination.”

If a bakery has a free speech right to discriminate, gay groups contend, then so do all businesses that may be said to engage in expression, including florists, photographers, tailors, choreographers, hair salons, restaurants, jewelers, architects and lawyers. A ruling for Mr. Phillips, they say, would amount to a broad mandate for discrimination.

The case, Masterpiece Cakeshop v. Colorado Civil Rights Commission, No. 16-111, will be argued in the late fall and is likely to turn on the vote of Justice Anthony M. Kennedy, who is simultaneously the court’s most prominent defender of gay rights and its most ardent supporter of free speech.

His majority opinion in Obergefell v. Hodges, the 2015 decision establishing a constitutional right to same-sex marriage, seemed to anticipate clashes like this one. Justice Kennedy called for “an open and searching debate” between those who opposed same-sex marriage on religious grounds and those who considered such unions “proper or indeed essential.”