On my D3100 this is how it works, and I think your 5100 is very similar:
If you are using flash, and have the ISO mode set to "auto ISO" every single time you use flash, it will set the ISO to 3200. You want to go to "ISO sensitivity" on the shooting menu, and set "auto ISO sensitivity" to OFF. I don't know why it does this, but others have verified this for me a few months ago.
With the "auto ISO" on, it will set the ISO up to your specified max, to hold the shutter speed up to whatever shutter speed you select as the minimum desired speed. This can be very useful, if you are in changing light conditions, as long as you don't use the flash.
If you have the mode on the big dial set to auto, the camera will select varying ISO settings depending on the subject, even if you are using flash. If the complete auto mode is set, you cannot modify the ISO setting. It will not always be 3200, but it could be. I just made a couple of test shots to verify this. One of them was at 2500, the other at 2800, in a moderately dim room with the flash automatically popped up.
Hope this helps.
working on it in Middle TN Nikon D3100
35 mm 1.8 Nikkor 18-55 mm Nikkor VR 55-200 mm Nikkor VR 55-300 mm Nikkor VR 150-500 mm Sigma OS Feisol CT3471 & Markins M20 ballhead