From the Super Mario Wiki
The minigame takes place on a 5 x 4 grid, where Monty Moles and Luigis come out of holes, and quickly hide back in them. Each Monty Mole is worth one point if whacked. However, the player should be careful that Luigis sometimes pop out. If Luigi is hit, the player loses three points. The player must rack up as many points as possible within the thirty-second time limit. There is also the multiplayer version where up to four players can compete and whoever has the most points when time is up, wins the game. Another minigame with a similar name is called Whack-a-Goomba.
 In-game instructions
Whack Monty Mole whenever he pops out of a hole! WHACKITY WHACK!!! You'll lose points if you hit poor Luigi by mistake. Be careful! How many Monty Moles can you whack?