(a) Whenever any person who has not previously been convicted of any offense under this chapter or under any statute of the United States or of any state relating to narcotic drugs, marihuana, or stimulant, depressant, or hallucinogenic drugs, pleads guilty to or is found guilty of possession of a controlled substance under section 401(c), the court, without entering a judgment of guilt and with the consent of the accused, may defer further proceedings and place him or her on probation upon terms and conditions. Upon violation of a term or condition, the court may enter an adjudication of guilt and proceed as otherwise provided. Upon fulfillment of the terms and conditions, the court shall discharge the person and dismiss the proceedings against him or her. Discharge and dismissal under this section shall be without adjudication of guilt and is not a conviction for purposes of this section or for purposes of disqualifications or disabilities imposed by law upon conviction of a crime, including the additional penalties imposed for second or subsequent convictions under section 408. The effect of the dismissal and discharge shall be to restore the person in contemplation of law to the status he or she occupied prior to arrest and trial. No person as to whom a dismissal and discharge have been effected shall be thereafter held to be guilty of perjury, false swearing, or otherwise giving a false statement by reason of his or her failure to disclose or acknowledge his or her arrest or trial in response to any inquiry made of him or her for any purpose. There may be only one discharge and dismissal under this section with respect to any person.
(b) After a period of not less than six months which shall begin to run immediately upon the expiration of a term of probation imposed upon any person under this chapter, the person may apply to the court for an order to expunge from all official records all recordations of his or her arrest, trial, and conviction, pursuant to this section. If the court determines after a hearing that the person during the period of his or her probation and during the period of time prior to his or her application to the court under this section has not been guilty of any serious or repeated violation of the conditions of his or her probation, it shall order the expungement.
(c) Notwithstanding any provision of this code to the contrary, any person prosecuted pursuant to the provisions of this article whose case is disposed of pursuant to the provisions of this section shall be liable for any court costs assessable against a person convicted of a violation of section 401(c) of this article. Payment of such costs may be made a condition of probation.
The costs assessed pursuant to this section, whether as a term of probation or not, shall be distributed as other court costs in accordance with section two, article three, chapter fifty, section four, article two-a, chapter fourteen, section four, article twenty-nine, chapter thirty and sections two, seven and ten, article five, chapter sixty-two of this code.