Dumbledore is not unlockable as a playable character in LEGO Harry Potter: Years 1–4 or Years 5–7.
He appears in cutscenes and scripted sequences (e.g., giving Harry the Invisibility Cloak, dueling Voldemort), but the game's character roster does not include him for free play.
You can unlock 100+ others by collecting Gold Bricks and completing levels:
If you want to play as Dumbledore, try LEGO Dimensions (fun pack) or mods (PC).