Sort or 'Splode
From the Super Mario Wiki
In the minigame, the player must use the Stylus to put Bob-omb Buddies in the red section and the Bob-ombs in the black section. Many Bob-ombs will appear, and as the game goes on, it will get harder. If a Black Bob-omb gets put in the red section or a Red Bob-omb in the black section, it will explode, along with the ones that are collected, and the game will end.
Once forty Bob-ombs of one color are placed in their section, the game will stop for a moment and the whole platform will empty and start totaling the player's current score. The game resumes after forty points have been tallied up (as seen in the picture).
After a Bob-omb is wandering for a long time, and hasn't been put in a section, it will blow up, and any remaining Bob-ombs will then be added to the player's previous score to get their final score overall to end the game.
 In-game instructions
Super Mario 64 DS: Guide Bob-ombs to the black carpet and Bob-omb Buddies to the red carpet. If you bring in the wrong-colored Bob-omb, it will blow up!