As you begin the stage, swim down and through the tunnel, entering the second area. Exploring a bit, there is a cage underwater that seems to have no point of entry at all. However, there are two things you can use to make getting this star much easier, which are the Metal Cap and Vanish Cap. These are located on the boardwalk on the surface, on the one end, behind some gratings that you can easily jump over. Despite the game saying to “collect the caps,” you really only need the Vanish Cap for this star, since it’s required to enter the cage.
With just the Vanish Cap, you have more than enough time to make it to the star before the power disappears. The Metal Cap might make it so you won’t get pulled at all from the force of the giant hole left by Bowser’s sub exiting, but it’s not necessary at all. Once you don the Vanish Cap, jump into the water and swim straight for the cage, entering it and collecting the star.