If a child custody case has been filed, with the reason you provided (father exposed child to marijuana) the Court may not agree to a voluntary dismissal. However, if it is the father, that is no longer seeking to have some type of custody, than maybe the Court will allow him to withdraw his case. To properly answer your questions and address your concerns, the best way to handle this is with an in person consultation with an experienced matrimonial attorney. Good luck.
If the case has not been joined, and that means if you are the only one who filed and there is no filing by the other parent, you can write the clerk of the family court including the FD docket number and indicate that you are WITHDRAWING your complaint for custody and will not be attending for the scheduled hearing. You should send a copy of that letter to the other parents and show the cc: on the letter to the Court. If you have already resolved the matter outside of court, you can further advise the court that you and the father have resolved the disputes amicably. If the matter has been joined and the other parent has responded or requested relief, then that parent must also join in the request for withdrawal of his/her requests as well. Worse case, you both appear on the date of the scheduled hearing and inform the Court that neither of you wish to pursue the claims that were filed and you wish to withdraw the pleadings that caused the court appearance. The court may ask questions: Are you doing this of your own free will? Have you resolved your concerns about the MJ use? The Court may ask questions about the child's well being related to your original complaint.
There is no fee to file a voluntary dismissal. You would simply go to the Clerk of the Court and submit the document. It would be best to speak with a local family law attorney even if just for an hour. Based upon your post, it might be problematic to file one if the case has already begun if the Court is aware of the allegations.