2005 Polaris Ranger 4×4 Dying Problems.

I have a basic 2005 Polaris Ranger 500 4×4 that I use on my farm. After you ride it for 20-30 minutes it just dies. When you try to start it back it just cranks. The battery comes on and has plenty of power for the lights to come on. After 45-60 minutes it will crank right up like nothing was ever wrong.
Any suggestions. Thanks for the help.