Quantum sensing using molecular qubits is expected to provide excellent sensitivity due to the proximity of the sensor to the target analyte. However, many molecular qubits are used at cryogenic temperatures, and how to make molecular qubits respond to specific analytes remains unclear. Here, we propose a new material design in which the coherence time changes in response to a variety of analytes at room temperature. We used the photoexcited triplet, which can be initialized at room temperature, as qubits and introduce them to a metal–organic framework that can flexibly change its pore structure in response to guest adsorption. By changing the local molecular density around the triplet qubits by adsorption of a specific analyte, the mobility of the triplet qubit can be changed, and the coherence time can be made responsive.