We develop and test numerically a lattice-Boltzmann (LB) model for nonideal fluids that incorporates thermal fluctuations. The fluid model is a momentum-conserving thermostat, for which we demonstrate how the temperature can be made equal at all length scales present in the system by having noise both locally in the stress tensor and by shaking the whole system in accord with the local temperature. The validity of the model is extended to a broad range of sound velocities. Our model features a consistent coupling scheme between the fluid and solid molecular dynamics objects, allowing us to use the LB fluid as a heat bath for solutes evolving in time without external Langevin noise added to the solute. This property expands the applicability of LB models to dense, strongly correlated systems with thermal fluctuations and potentially nonideal equations of state. Tests on the fluid itself and on static and dynamic properties of a coarse-grained polymer chain under strong hydrodynamic interactions are used to benchmark the model. The model produces results for single-chain diffusion that are in quantitative agreement with theory.