A signal of a spectrometric gamma-gamma density tool in specific borehole conditions has been numerically calculated. Transport of gamma rays, from a point (137)Cs gamma source situated in a borehole tool, through rock media to detectors, has been simulated using a Monte Carlo code. The influence of heterogeneity of the rock medium surrounding the borehole on the signal of the detectors has been examined. This heterogeneity results from the presence of an interface between two different geological layers, parallel to the borehole wall. The above conditions may occur in horizontal logging, when the borehole is drilled along the boundary of geological layers. It is possible to assess the distance from the boundary on the basis of the responses of the gamma-gamma density tool, using the classic interpretation "spine & ribs" procedure. The effect of different densities of the bordered layers on the tool response has been analyzed. The presented calculations show the wide possibilities of numerical modeling of the complex borehole geometry and solving difficult interpretation problems in nuclear well logging.