Data assimilation techniques, developed in the past two decades mainly for weather prediction, produce better forecasts by taking advantage of both theoretical/numerical models and real-time observations. In this paper, we explore the possibility of applying the four-dimensional variational data assimilation (4D-VAR) technique to the prediction of solar flares. We do so in the context of a continuous version of the classical cellularautomaton-based self-organized critical avalanche models of solar flares introduced by Lu and Hamilton (Astrophys. J. 380, L89, 1991). Such models, although a priori far removed from the physics of magnetic reconnection and magnetohydrodynamical evolution of coronal structures, nonetheless reproduce quite well the observed statistical distribution of flare characteristics. We report here on a large set of data assimilation runs on synthetic energy release time series. Our results indicate that, despite the unpredictable (and unobservable) stochastic nature of the driving/triggering mechanism within the avalanche model, 4D-VAR succeeds in producing optimal initial conditions that reproduce adequately the time series of energy released by avalanches and flares. This is an essential first step toward forecasting real flares.