At this time, no single test diagnoses ankylosing spondylitis. Your doctor may order a blood test to check for the HLA-B27 gene, which is present in most people with the disease. You may have the HLA-B27 gene and never develop ankylosing spondylitis, but it can give doctors more information when making a diagnosis.