see if it is a calibration issue or the afs mechanism by putting an old manual prime lens, or one that you can really control the focus manually, and see if the focus confirmation lines up with what your eye sees,
then,, put in in live view, and zoom into the spot that you and the camera think are in focus, and validate that it is pin sharp,
If not, then should be your actual focus sensors and their calibration, if sharp,, then it could be the lens instead.
I usuall D version lens, but the 5100 has to have G lens, so,, should be perfect,
I assume that test is on a tripod, cable or timer release, eliminate human shake.