The machine didn't get it wrong. The POI was the judge. Reese does think it was wrong at first:
Reese: Finch, what's the son's name again?
Finch: Samuel Gates Junior. Why?
Reese: I think we've been following the wrong Sam Gates.
Reese says it because the son is then kidnapped. But the machine identified Sam the father because he's the victim of a bigger conspiracy involving a crime gang and money laundering. This is also explained in the episode:
Finch: The machine identifies malice and an intent to harm. We need to determine which threat it saw, which one is real. [...] The machine did not send us the wrong number. If it says that judge Gates is in danger, then he is. [...] The kidnapping must connect. It could be the first step in a larger plot.
And he's right. The son's kidnapping is supposed to sway the judge to rig a trial, so he's a potential victim of extortion and eventually murder, as Finch states near the end:
Finch: The machine sent us his number because they were planning to kill him all along. Him and his son.