The Azure Flute was never distributed legitimately in most regions, so the only way to obtain one is through a cheating device such as an Action Replay and an event code found online.
Enter the code, start the game, and a Mystery Gift option becomes available. Select it, choose the item you want, then load your save and enter any Poké Mart while holding L and R. A character will be standing in the bottom-left corner; talk to them and you receive the Azure Flute.
Go to the summit of Mt. Coronet where you fought Dialga or Palkia. Use the flute and a flight of stairs appears. Save before climbing. At the top is Arceus at level 80, knowing Hyper Beam, Recover, Future Sight and one further move.
Bring plenty of Ultra Balls and a sleep-inducing move, since a level 80 legendary will not go quietly.