Compositing of borehole assay intervals based on economic aspects is a primary step when the cross-sectional method is applied in orebody modelling and mineral resources estimation. The compositing is important because the resulting ore composites eventually determine the outlines of orebody models. However, numerous boreholes and borehole intervals make ore compositing tedious and time-consuming for manual work. A computer program for compositing is desirable to facilitate the task and to obtain accurate results. In the design of computer algorithms for such a computer program, dilution is the most difficult part because dilution means adding waste intervals into an ore composite in order to transfer it from unminable to minable and this causes some special situations in a compositing procedure. In order to obtain economically optimized compositing results, we paid special attention to dilution in the designed algorithms. A demo program has been developed to test and implement these algorithms using borehole assay datasets from a mine site in China. Results show the accuracy of designed computer algorithms and the feasibility of applying a computer program in compositing of borehole assay intervals.