It's not clear exactly what is meant by 'an unsatisfactory reference'.
If your former employer received a request for a reference and simply responded with the one word "Unsatisfactory", you'd obviously have cause for complaint.
However, your former employer has to be aware that the CIvil Service is subject to audit. If you've been given 'medical retirement', it implies that somebody within the Civil Service has signed a document stating that you're unfit for work (and has presumably committed money, from the public purse, to pay you some form of a pension).
If someone in the Civil Service now signs another document (i.e. your reference) and states that you're fit for work, the public auditor could question the competence of the person who signed the original document.
The best that you can hope for is that you will be given a comprehensive reference which states, for example, that (prior to your illness) your attendance and punctuality were exemplary and that your work and relationships with colleagues could not be criticised in any way. However, you can't expect your former employer to hide the fact that you left your employment because you were judged unfit to work on medical grounds.
Chris