Aims. Among the known Ap stars, HD 101065 is probably one of the most interesting objects, demonstrating very rich spectra of rareearth elements (REE). Strongly peculiar photometric parameters of this star can not be fully reproduced by any modern theoretical calculations, even those accounting for realistic chemistry of its atmosphere. In this study we investigate a role of missing REE line opacity and construct a self-consistent atmospheric model based on accurate abundance and chemical stratification analysis. Methods. We employed the LLmodels stellar model atmosphere code together with DDAFit and Synthmag software packages to derive homogeneous and stratified abundances for 52 chemical elements and to construct a self-consistent model of HD 101065 atmosphere. The opacity in REE lines is accounted for in details, by using up-to-date extensive theoretical calculations. Results. We show that REE elements play a key role in the radiative energy balance in the atmosphere of HD 101065, leading to the strong suppression of the Balmer jump and energy redistribution very different from that of normal stars. Introducing new line lists of REEs allowed us to reproduce, for the first time, spectral energy distribution of HD 101065 and achieve a better agreement between the unusually small observed Strömgren c 1 index and the model predictions. Using combined photometric and spectroscopic approaches and based on the iterative procedure of abundance and stratification analysis we find effective temperature of HD 101065 to be T eff = 6400 K.