At 7-8 years the baby is not formed yet, and no sex organs have developed. Although genetically it is possible to find out, it is a very complicated test, and I'm not sure it can be done. At any rate, I have never heard of such a test being done.
If you're asking about your own miscarriage, I'm sorry you had to go through such a difficult experience. I know how hard it is.