The district attorney and the offender may enter into an agreement as a part of the pretrial diversion program of an offender that the offender be admitted to a drug or alcohol program on an in patient or out patient basis or receive other treatment alternatives for substance abuse. The district attorney may require the offender to submit to periodic or random drug testing as a part of the pretrial diversion program of the offender and other terms and conditions related to substance abuse as the district attorney may direct. The offender shall pay the costs of all services unless otherwise approved by the district attorney.