This paper reports on the fabrication and characterization of a high purity monocrystalline diamond detector with buried electrodes realized by the selective damage induced by a focused 6 MeV carbon ion beam scanned over a pattern defined at the micrometric scale. A suitable variable-thickness mask was deposited on the diamond surface in order to modulate the penetration depth of the ions and to shallow the damage profile toward the surface. After the irradiation, the sample was annealed at high temperature in order to promote the conversion to the graphitic phase of the end-of-range regions which experienced an ion-induced damage exceeding the damage threshold, while recovering the sub-threshold damaged regions to the highly resistive diamond phase. This process provided conductive graphitic electrodes embedded in the insulating diamond matrix; the presence of the variable-thickness mask made the terminations of the channels emerging at the diamond surface and available to be connected to an external electronic circuit. In order to evaluate the quality of this novel microfabrication procedure based on direct ion writing, we performed frontal Ion Beam Induced Charge (IBIC) measurements by raster scanning focused MeV ion beams onto the diamond surface. Charge collection efficiency (CCE) maps were measured at different bias voltages. The interpretation of such maps was based on the Shockley-Ramo-Gunn formalism.