There's a lot to unpick here!
I would suggest that the first thing to do is to sit down with the mother and have a genuine conversation about what is the best thing for the child. If the child has been raised knowing you as a father, it could be quite tricky to learn you aren't biologically related and this was deliberately kept from them. However, this forum would be an excellent place to find advice about telling children difficult things and how to manage it!
The situation seems quite complicated. If you know the child isn't biologically yours for sure, i dont know what good a dna test would be other than to allow you to be "surprised" at the outcome.
There are a lot of factors at play, but I'm usually a fan of telling the truth where possible, and building relationships based on that. Continuing as is seems impossible if the situation has escalated to the courts, but would it not be possible for you to keep playing some form of fatherly figure in the childs life regardless of your dna? Thats if you want it. If you decide not to see the child in question, thats a big loss tor you. In addition your biological children may feel that they have lost a sibling ( i dont know how close they are). You also want to consider that the child may wish to know their birth father, because of many reasons- curiosity, health conditions, desire to know about any other siblings etc.
It is hard to comment much further as we don't know much about why the birth mother is initiating court proceedings, or the details, but I would be asking yourself what you want the relationship with the child would ideally look like in the future and what steps you can take towards this. If it is as named father, because you want custody, what would you need to do to secure that? If you are deep down secretly hoping to relieve yourself of responsibility for a child you took on several years ago in less than typical circumstances ( not saying you are, just that it might be one layer of emotion) how can you do this without causing too much emotional damage? If you are not going to be legally the father, and are ok with that, what role would you want to play in the child's life, if any? That will form the basis of what you "should" do I would imagine.