In order to punish the baker, the judges will have to ignore evidence and guess at intent. All they know is that the baker refused to do cake for a same-sex wedding. In order to prove discrimination, they will have to guess it was due to the parties being gay. If it had been 2 straight men, they have to guess that the baker would have made the cake for them.
Although if two straight men asked for a cake, by definition it would not have been a homosexual wedding cake.