A coarse‐grained model of heteropolymer (polypeptide) chains in a slit was designed in order to study the folding process in confinement. The idealized chains represented heteropolymers consisted of hydrophobic and hydrophilic united atoms, which were restricted to vertices of a (310) lattice. The force field consisted of the excluded volume, the long‐distance potential between pairs of segments and the local helical potential. Monte Carlo simulations were performed using the algorithm with micromodifications of the chain's conformation and employing the Replica Exchange technique. The influence of the size of the slit, the temperature and the force field on the dimension and the structure of chains were studied. It was shown that a moderate confinement stabilizes folded chains while a strong confinement does not.