As you pass by the tall hill near the end of the course with the Mankey jumping around on top (it's on the right hand side), you'll notice a trio of Squirtle playing near the bottom of that hill. Wait until you're lined up with a Squirtle directly between you and the Mankey, ensure the Squirtle is facing up the hill at the Mankey and then hit the Squirtle with a Pester Ball. The Squirtle will Withdraw and slide up the hill, knocking the Mankey down the other side.
When you round the bend, the Mankey will be on the nearside shore, the same shore as the red switch. Line up the Mankey directly between yourself and the switch, ensure the Mankey is close enough to the switch and then hit it with a Pester Ball. It'll fly backwards and land on the switch, opening the metal gate. After you've completed this the first time, you can perform this sequence again later and use it to get some good, close photos of the Mankey.