A novel photoelectrochemical immunosensor based on the competitive strategy is proposed for the specific detection of dexamethasone (DXM). Graphitic carbon nitride coupled with bismuth sulfide are used as the sensing matrix for the immobilization of BSA-DXM on the electrode surface, while cadmium sulfide functionalized titanium dioxide (TiO2@CdS) is used as the photoelectric active labels of anti-DXM. Due to the perfect matching of energy levels between TiO2 and CdS, the in situ prepared composite labels show excellent photocurrent response under visible lights. The competitive binding of DXM in sample solutions and BSA-DXM on the electrode surface reduces the specific attachment of labels to the electrode, resulting in a decrease of the photocurrent intensity. Greatly enhanced sensitivity is achieved after the optimization of the detection conditions. Under the optimal detection condition, the well-designed immunosensor for DXM exhibits a low detection limit of 2 pg ∙ mL(-1). Additionally, the proposed immunoassay system shows high specificity, good reproducibility and acceptable stability, which is also expected to become a promising platform for the detection of other small molecules.