Observations of solar flares at sub-THz frequencies (mm and sub-mm wavelengths) over the last two decades often show a spectral component rising with frequency. Unlike a typical gyrosynchrotron spectrum decreasing with frequency, or a weak thermal component from hot coronal plasma, the observations can demonstrate a high flux level (up to ~10^4 s.f.u. at 0.4 THz) and fast variability on sub-second time scales. Although, many models has been put forward to explain the puzzling observations, none of them have clear observational support. Here we propose a scenario to explain the intriguing sub-THz observations. We show that the model, based on free-free emission from the plasma of flare ribbons at temperatures 10^4-10^6 K, is consistent with all existing observations of frequency-rising sub-THz flare emission. The model provides a temperature diagnostic of the flaring chromosphere and suggests fast heating and cooling of the dense transition region plasma.