Probably not even a couple hours. Figure about an hour to get into Munich and to the fest grounds, and the same back, so down to 3 hours. Boarding usually means the door closing a half hour before departure, then leaving yourself a half hour buffer for unexpected things (have to wait for the next S-Bahn, then the next train), so down to two hours, one of those could easily be chewed up by security getting back into the airport. So, maybe, safely, an hour there, not counting if there is a line for entry security at the fest.
But is it worth it? Sure, why not. You only live once. You probably will not be able to have a beer in a tent (need a seat, then wait to be served, drink a liter of beer, then book it out of there) but there are some stands that sell beer and you can walk into tents at least to take a pic or a look. You can also get an Octoberfest Pin, maybe a funny hat.