The judge realizes he's become a joke among people with sense. Costello can mop the flood with the 'da judge'...an idiot fool. Merchan thought he could whore for the democrat party and 'win'. He can't. This outburst is just more proof of that.
Merchan has the authority to tell Costello to leave the courtroom, but it wasn’t necessary for him to scream at Costello.