Symptoms of both gout and septic arthritis include redness and swelling present in just one joint and pain that is worse with movement.
The key distinction is the results of a culture of the joint fluid obtained by aspiration: a positive culture defines an infection.
One could consider the history (patients with known gout are of course more likely to have gout as the cause, as compared to patients without that history; patients with immune suppression are of course at higher risk for infection).
One could also measure the concentration of white blood cells in the aspirate: the number of cells is higher in cases of infection. The problem is that there is no cut off that perfectly segregates the two.
One can also examine the aspirate under the microscope: crystals suggest gout, and bacteria indicate infection. Yet crystals can be seen in cases of infection as well (where both conditions are present simultaneously).
Because culture results are not known immediately, all of the information listed above should be considered, especially when urgent treatment is needed.
