From the Super Mario Wiki
The minigame plays exactly like its single-player counterpart, Pair-a-Gone. Both players must clear the cards off their table by tapping two identical cards adjacent to each other, be it horizontally, vertically, or diagonally. Both players start with thirty cards (for a total of sixty), and any pairs that are cleared are placed in the opponent's deck. The player with the least amount of cards overall when the time is up is the winner. The game ends early if a player removes all the cards from the table.
Names in others languages
"Match up cards horizontally, vertically, or diagonally to remove them from the table. Cleared cards move to your opponent's table. The player with the fewest cards when time runs out wins."