The FARs are pretty clear about this. If it is installed it must be inspected within 24 months—otherwise you can’t fly (with some exceptions e.g. ferry permit). If it passed inspection, it must be on. If it fails then you may fly with an inoperative transponder (with some exceptions and notifications as described in the FAR). You can’t turn it off and fly legally.
In your case you cannot fly because you have an operable transponder that has not been inspected (and passed) in the previous 24 months and you want to fly in controlled airspace.
§91.413 ATC transponder tests and inspections.
(a) No persons may use an ATC transponder that is specified in
91.215(a), 121.345(c), or §135.143(c) of this chapter unless, within the preceding 24 calendar months, the ATC transponder has been tested
and inspected and found to comply with appendix F of part 43 of this
§91.215 ATC transponder and altitude reporting equipment and use.
(c) Transponder-on operation. While in the airspace as specified in
paragraph (b) of this section or in all controlled airspace, each
person operating an aircraft equipped with an operable ATC transponder
maintained in accordance with §91.413 of this part shall operate the
transponder, including Mode C equipment if installed, and shall reply
on the appropriate code or as assigned by ATC, unless otherwise
directed by ATC when transmitting would jeopardize the safe execution
of air traffic control functions.
(d) ATC authorized deviations. Requests for ATC authorized deviations
must be made to the ATC facility having jurisdiction over the
concerned airspace within the time periods specified as follows:…