The goal of the present work is the development of a decentralized attitude control algorithm for satellite formation flying. The attitude control algorithm of the formation flying is tested in the orbital-reference coordinate for the sake of applying the control algorithms to Earth observing missions. Because of the nonlinearity of the dynamic system, the State-Dependent Riccati Equation (SDRE) technique is applied and then the results are compared to those from linear control methods, mainly the PD and LQR controllers. In order to complement a constant control strategy for relative attitude error in formation, a selective control strategy is suggested. This strategy guarantees not only a reduction of unnecessary calculation but also, the stability of the attitude control algorithm of satellite formation. The results have shown that the SDRE technique can robustly drive the attitude errors to converge to zero.