It is well known that surface tension is dependent on temperature, and thus a nonuniform temperature may cause thermocapillary flow which is referred to as the Marangoni effect. For a thin liquid-air film confined between a flat hot plate and a topographical cold template, it undergoes deformation due to thermocapillary flow. This phenomenon is termed as thermocapillary patterning, and has been used to fabricate micro- and nanostructure in polymer films. In most cases, the obtained structure conforms to the template; i.e., it can be considered as a replication technique. In this paper, we developed a two-phase flow numerical model based on the phase field to study the dynamic process of thermocapillary patterning. As a remeshing-free method, the phase field enables the incorporation of thermal field and multiphase flow with free surface deformation. The numerical model was employed to study the dynamic process of thermocapillary patterning. Meanwhile, the effects of some parameters, e.g., temperature, geometry parameters, and contact angle, were also investigated.