Plant factories are an advanced form of facility agriculture that enable efficient plant cultivation through controllable environmental conditions, making them highly suitable for the automation and intelligent application of machinery. Tomato cultivation in plant factories has significant economic and agricultural value and can be utilized for various applications such as seedling cultivation, breeding, and genetic engineering. However, manual completion is still required for operations such as detection, counting, and classification of tomato fruits, and the application of machine detection is currently inefficient. Furthermore, research on the automation of tomato harvesting in plant factory environments is limited due to the lack of a suitable dataset. To address this issue, a tomato fruit dataset was constructed for plant factory environments, named as TomatoPlantfactoryDataset, which can be quickly applied to multiple tasks, including the detection of control systems, harvesting robots, yield estimation, and rapid classification and statistics. This dataset features a micro tomato variety and was captured under different artificial lighting conditions, including changes in tomato fruit, complex lighting environment changes, distance changes, occlusion, and blurring. By facilitating the intelligent application of plant factories and the widespread adoption of tomato planting machinery, this dataset can contribute to the detection of intelligent control systems, operation robots, and fruit maturity and yield estimation. The dataset is publicly available for free and can be utilized for research and communication purposes.