A smart greenhouse can be considered as a very large chamber under closed conditions. The amount of change in CO2 concentration inside the greenhouse during periods without CO2 fertilization depends on the net primary production (i.e., net carbon assimilated by plants via photosynthesis) (NPP) of the crops grown in the greenhouse. In this study, we estimated the NPP of cucumbers in a small-scale smart multi-span plastic greenhouse using environmental and control information collected during a low-temperature period when the greenhouse was frequently closed. The timescale for robustly calculating NPP using the temporal change in the CO2 concentration inside the greenhouse was empirically determined (=10 min), and a random forest-based NPP model was established using the calculated NPP and internal and external environmental greenhouse data to estimate NPP, even in the cases of opening roof windows or supplying CO2. The estimated NPP showed previously known relationships with environmental variables in the greenhouse, and cumulative NPP was consistent with cucumber growth. Based on the CO2 balance equation of a smart greenhouse and estimated NPP, we quantified the amount of CO2 supplied and CO2 emissions via the roof windows. The CO2 budget estimation errors and suggestions for reducing errors were discussed. The quantified CO2 budget in the greenhouse, including NPP, can be used for evaluating economic feasibility and improving crop productivity.