  Electronic nematicity plays important role in iron-based superconductors.
These materials have layered structure and theoretical description of their
magnetic and nematic transitions has been well established in two-dimensional
approximation, i.e., when the layers can be treated independently. However, the
interaction between iron layers mediated by electron tunneling may cause
non-trivial three-dimensional behavior. Starting from the simplest model for
orbital nematic in a single layer, we investigate the influence of interlayer
tunneling on bulk nematic order and possible preemptive state where this order
is only formed near the surface.
  We found that the interlayer tunneling suppresses the bulk nematicity which
makes favorable formation of a surface nematic above the bulk transition
temperature. The purely electronic tunneling Hamiltonian, however, favors
alternating from layer-to-layer nematic order parameter in the bulk. The
uniform bulk state typically observed experimentally may be stabilized by the
coupling with the elastic lattice deformation. Depending on strength of this
coupling, we found three regimes: (i) surface nematic and alternating bulk
order, (ii) surface nematic and uniform bulk order, and (iii) uniform bulk
order without the intermediate surface phase. The intermediate surface-nematic
state may resolve the current controversy about the existence of the weak
"meta-nematic transition" in the compound BaFe$_2$As$_{2-x}$P$_{x}$.
