Context. Microquasars are accreting Galactic sources that are commonly observed to launch relativistic jets. One of the most important issues regarding these sources is the energy budget of ejections relative to the accretion of matter. Aims. The X-ray binary, black hole candidate, and microquasar H 1743-322 exhibited a series of X-ray outbursts between 2003 and 2008. We took optical and near-infrared (OIR) observations with the ESO/NTT telescope during three of these outbursts (2003, 2004, and 2008). The goals of these observations were to investigate the presence of a jet, and to disentangle the various contributions constituting the spectral energy distribution (SED): accretion, ejection, and stellar emission. Methods. Photometric and spectroscopic OIR observations allowed us to produce a high time-resolution lightcurve in K s -band, to analyze emission lines present in the IR spectra, to construct a multiwavelength SED including radio, IR, and X-ray data, and to complete the OIR vs. X-ray correlation of black hole binaries with H 1743-322 data points. Results. We detect rapid flares of duration ∼5 min in the high time-resolution IR lightcurve. We identify hydrogen and helium emission lines in the IR spectra, coming from the accretion disk. The IR SED exhibits the spectral index typically associated with the X-ray high, soft state in our observations taken during the 2003 and 2004 outbursts, while the index changes to one that is typical of the X-ray low, hard state during the 2008 outburst. During this last outburst, we detected a change of slope in the NIR spectrum between the J and K s bands, where the JH part is characteristic of an optically thick disk emission, while the HK s part is typical of optically thin synchrotron emission. Furthermore, the comparison of our IR data with radio and X-ray data shows that H 1743-322 exhibits a faint jet both in radio and NIR domains. Finally, we suggest that the companion star is a late-type main sequence star located in the Galactic bulge. Conclusions. These OIR photometric and spectroscopic observations of the microquasar H 1743-322, which are the first of this source to be published in a broad multiwavelength context, allow us to unambiguously identify two spectra of different origins in the OIR domain, evolving from optically thick thermal emission to optically thin synchrotron emission toward longer wavelengths. Comparing these OIR observations with other black hole candidates suggests that H 1743-322 behaves like a radio-quiet and NIR-dim black hole in the low, hard state. This study will be useful when quantitatively comparing the overall contribution of the compact jet and accretion flow in the energy budget of microquasars.