You can generally avoid protective proceedings by placing your child with an appropriate relative before the court proceedings begin, but once a petition is filed you no longer have that power.
It seems a bit odd for the social worker to file a petition to remove your child under circumstances where there's apparently no basis for emergency removal. You need to discuss the facts and the allegations in the petition with your lawyer, and see if your mother (or another appropriate relative) is willing to accept a placement if the court finds that you (and your boyfriend,assuming he's the father) are not appropriate custodians.

