In order to get Ditto from a Pokéball you must have an Action Replay cheat device. You can buy a newer one here, but (despite what Datel says) it only works on Gamecube, NOT Wii (Unless you've never updated your Wii...). The newer one does not allow you to add codes, but I think the debug menu code is there already.
Your version appears on the bottom of your SSBM Disc (e.g. DOL-GALE-0-02 USA is v1.2, DOL-GALE-0-01 USA is v1.1, etc.)
Load up the Action Replay :
And enter the code and load up the game with it enabled.
When the game starts, just press A to go through the menus and the debug menu should come up instead of the 'character select' screen.
Make sure you switch "DBLEVEL" to "DEVELOP" as shown above, you can also change "LANGUAGE" to "GMLANGTYPEUS" for English characters (for taunts, announcer, etc.). "PUBLICITY" is for the crowd noises.
Select "VERSUS MODE >" to choose your VS. options.
In order to make the Pokéball appear you must turn on items as shown above. Chose "MODE : RULE >" to change the settings. Change "ITEM SWITCH: NOTHING" to anything else (like "VERYLOW").
When you're done, press B and then choose "MODE : DAIRANTOU >" to choose your character, level, etc. and then press START when you're done to begin the match.
At any time in the match, press + or to chose your Pokémon (They have Japanese names)
Ditto is "METAMON" as you can see. Then, press to make your item appear. (There can only be one Ditto on the stage at a time.)
And then Ditto appears!
Here's the YouTube Video: