Using a hybrid density-functional scheme, we address the O impurity substitutional to N (ON) in In0.17Al0.83N. Our modelling supports In clustering to account for the strong band-gap bowing observed in InxAl1−xN alloys. To study the ON defect in In0.17Al0.83N alloys, we therefore consider a model containing an In cluster and find that the most stable configuration shows four In nearest neighbors. We show that such a ON defect forms a DX center and gives rise to two defect levels at 0.70 and 0.41 eV below the conduction band edge, in good agreement with experiment. The calculated defect energetics entail a fast nonradiative recombination upon photoexcitation at room temperature and account for the observation of persistent photoconductivity at low temperature.