Dobby does not appear as a playable character in LEGO Harry Potter: Years 1–4. He debuts in Harry Potter and the Chamber of Secrets (Year 2), but the game only includes characters from the first four books/films where he has limited presence.
Dobby becomes playable in LEGO Harry Potter: Years 5–7, featuring in Half-Blood Prince and Deathly Hallows levels.
If you're seeking a different character from Years 1–4, specify the name for help locating them.