You can obviously go to court and try to argue the citations, however they will likely stick. If you had been following at a proper distance you would have been able to stop in an orderly fashion and wouldn't have ended up spinning out into another lane. Obviously you were attempting to avoid rear-ending the person in front of you, which is good, but you still failed to maintain your lane.
This advice is intended for general information purposes only and may be based solely on my personal opinion or thoughts. Laws vary from state to state. If you have a serious matter, or feel as though you may, I advise you to contact an attorney in your area.
There is no automatic legal presumption against you, but as a practical matter I think you will lose this one in traffic court. I hope you have reported the incident to your insurance carrier, which will be obligated to provide coverage and a defense for the claims against you which are likely coming.