Recently we have demonstrated scalable, nondestructive, and high-fidelity detection of the internal state of 87Rb neutral atoms in optical dipole traps using state-dependent fluorescence imaging [M. Martinez-Dorantes, W. Alt, J. Gallego, S. Ghosh, L. Ratschbacher, Y. Völzke, and D. Meschede, Phys. Rev. Lett. 119, 180503 (2017), 10.1103/PhysRevLett.119.180503]. In this paper we provide experimental procedures and interpretations to overcome the detrimental effects of heating-induced trap losses and state leakage. We present models for the dynamics of optically trapped atoms during state-dependent fluorescence imaging and verify our results by comparing Monte Carlo simulations with experimental data. Our systematic study of dipole force fluctuations heating in optical traps during near-resonant illumination shows that off-resonant light is preferable for state detection in tightly confining optical potentials.