No, there is no Harry Potter LEGO video game released for the PlayStation 2.
The first LEGO Harry Potter game, LEGO Harry Potter: Years 1-4, launched in 2010 for PlayStation 3, Xbox 360, Wii, and PC. By that time, the PS2 was considered a last-generation console, and developers had largely stopped producing new titles for it.