First you have to file paper work with family court advising your are contesting paternity of the minor child. You will need to establish a link between you and the mother. If your case seems credible they will have the mother present the child for testing and the court will pay for the testing
Inquire for a free paternity test in your state, we know that every state offer's free or discounted clinical tests in their government clinics and health offices, etc to those qualified citizens of their place, be sure to have proper documents with you to attest that you are qualified to have that free or discounted paternity test.
You can appeal to the court and mention that you cannot pay for the test. The court may waive the cost of the test. There are also TV shows that offer free paternity tests for fathers who can't afford the test.
Go to court and apply for custody. If the mother protests based on disputed paternity, the Court will order the test. You can go to the Clerk of Courts and file a motion on your own without an attorney. Someone there can help you. Your motion will be heard a few days later and a hearing date set.