Probably it can be done, but you may not want to.
Flash and Auto ISO on Nikon DSLR has gone through three variations (making explanations difficult).
1. Older ones, from D70 to D300, never increased ISO if flash was recognized with Auto ISO. They always stayed at lowest value, simply because we were using flash instead. Good plan, there is much to be said for that.
2. Then from D300S and later, it changed. I believe (not positive) your D3100 is in this group. Then Auto ISO did its thing, adjusting for the ambient light level (resulting in very high ISO indoors), and then the flash power level had to adjust for this high ISO situation. Several things wrong with that, flash pictures ought not always be high ISO. And the ambient incandescent light was orange, and caused white balance problems.
3. The very latest models (D800, D600, D7100, and I really don't know what else) would only advance ISO by two stops (for example, only to ISO 400) when flash was used. This was reasonable for bounce, and ceased doing the absurdly high ISO.
You can determine your cameras ISO mode this way: With flash turned off, and Auto ISO on, indoors where you need flash, compose your picture and half press shutter to see what ISO is. Probably pretty high ISO in dim places where flash is needed. Then reach up and turn the flash power switch On. What does ISO do at half press?
1) will stay the same, low. 2) will remain at the sky high value. 3) will advance only 2 stops over minimum (4x value).
2. Above should work, exposure wise, just with very high ISO, and possibly orange. We need more info, etc, to explore why not, but really, it seems a moot point. You surely do want to turn Auto ISO off with flash.