Suing a public defender works the same way as suing any attorney who represented you. The most common claim against an attorney is for "ineffective assistance of counsel," where you challenge the attorney's representation as deficient. However, this is not an easy claim to advance. You will need to seek an attorney for proper representation if you plan to sue a public defender.
Get a lawyer. Although you can sue a lawyer without your own lawyer, ineffective assistance of counsel claims are difficult to win and require a practiced legal advocate to advance fully.
Document the instances where you believe your attorney was deficient or ineffective.
Consult with your new attorney to determine if it is worth bringing an ineffective assistance of counsel claim. Often, attorney decisions are protected under a doctrine that allows attorneys to make strategic choices in a case. An attorney will help you decide whether your public defender's actions are protected under this doctrine.
File a malpractice claim against the attorney in a court that has jurisdiction. This will probably be a state court, but you can have federal jurisdiction depending on your residence and the valuation of the suit.