You cannot get a public defender prior to your first court appearance. You will have to qualify for one on your first appearance before one can be assigned to you. It is up to the court to determine if you qualify. Some people don't qualify because they have a job and assets and ask for a pd because they don't think they can afford a lawyer.
Assuming you are facing a criminal charge, I highly recommend contacting a few attorneys in your area and taking advantage of free consultations. You will be quoted a fee by each one. That way, you'll know if you can afford a lawyer and know how much a lawyer costs.
Best of luck.