It is found in the X-Naut Fortress. It is on top of a shelf in the room with the Yux experiments. To reach it, Mario must go through a vent. After this, he must return it to the prize-grabber crane machine on Sublevel 1. The prize-grabber is in a strange room with a platform covered in prizes and some fancy devices.
The left, right, and middle buttons must be pressed to activate the machine. The crane is worked by pressing A to move it left and B to move it back. The badge Feeling Fine, a Star Piece, and some coins can be obtained on the platform.