Accurate temperature measurement is critical in many scientific and engineering fields, so that researchers continuously strive to improve the accuracy, sensitivity, and robustness of the current measurement methods. In this paper, we propose a theoretical approach for temperature measurement using an optomechanical system in which the position of a mechanical oscillator is coupled to the cavity field. Our approach enables precise control and manipulation of both, resulting in highly accurate temperature measurements. We evaluate the accuracy of temperature estimation by using classical and quantum Fisher information, considering both open and closed systems, and investigate entanglement effects of the primary field mode. Our findings indicate that increasing entanglement at the input made reduces measurement time and increases sensitivity in estimating the temperature. However, we observe that quantum coherence is destroyed by decoherence, leading to reduced performance of quantum systems. Furthermore, we show that the Fisher information of the system is robust against mechanical decoherence, but significantly damped due to optical decoherence. We discuss the limitations and challenges of our method and suggest possible applications and future directions for our research. Finally, we determine the accuracy of temperature estimation for a typical optomechanical system based on phase values measured in the closed system. Our results demonstrate the potential of optomechanical systems for highly accurate temperature measurement and their robustness against decoherence. This study can provide insights into the field of temperature measurement, offering a theoretical approach that can be applied in many scientific and engineering applications.