This paper is devoted to the theory of quantum electromagnetic field in an optically dense medium. Self-consistent equations describing interaction between a quantum field and a quantum dielectric medium are obtained from the first principles, i.e., outside a phenomenological description. Using these equations, we found a transformation (of the Bogoliubov transformation type) that converts the operators of the "vacuum" field into operators of collective perturbations of the field and an ensemble of atoms, that is, photons in the medium. Transformation parameter is the refractive index of the wave mode considered. It is shown that besides the energy of the collective electromagnetic field, the energy of photons in the medium includes the energy of the internal degrees of freedom of the substance and the energy of near-field dipole interaction between atoms in the polarized medium. The concept of negative energy photons is introduced on the basis of self-consistent equations.Keywords: Optically dense medium, quantum field, Bogoliubov transformation, photons in the medium 2 cuum). For example, for the medium with polarizability and refractive index 4 1 2 2 n ck the result obtained within this approach corresponds to the approximation of small optical density, 12 n . Despite the obvious constraints, this approach can be very effective. The point is that the approximation of small optical depth, i.e., the assumption that 11 n in a fairly narrow frequency band, does not contradict, in principle, the condition of strong frequency dispersion, 1 n . As an example, we mention the effect of electromagnetically induced transparency (EIT) [24][25][26][27]: which suggests that within the "transparency window" there is a frequency range in which a small group velocity is combined with an almost "vacuum" phase velocity. However, in general (including some of the EIT modes, see [26,27]), the constraint 11 n is awkward. To our knowledge, the analysis which is free of both the constraints of the phenomenological approach and the small optical density approximation, was carried out only in terms of a two-level model [5,[28][29][30].This paper is devoted to the development of the theory of quantum field in a medium with an arbitrary optical density and an arbitrary energy-level structure. Selecting as the initial model an ensemble of atoms interacting through a collective field, we came to fairly universal operator equations of quantum electrodynamics of a dielectric medium without spatial dispersion. Using these equations, it was found that the exact dispersion relation k for photons in the medium corresponds to the quanta of collective excitations of the field and the medium, and the energy k of a quantum includes the energy of the macroscopic field, the energy of the internal degrees of freedom, and the energy of the near-field dipole interaction in the polarized medium. It is shown that the operators of creation and annihilation the photon in the medium are related with t...