Energy dynamics in buildings are inherently stochastic in nature due to random fluctuations from various factors such as the solar gain and the ambient temperature. This paper proposes a theoretical framework for stochastic modeling of the building thermal dynamics as well as its analytical solution strategies. Both the external temperature and internal gain are modeled as a stochastic process, composed of a periodic (daily) mean-value function and a zero-mean deviation process obtained as the output process of a unit Gaussian white noise passing through a rational filter. Based on the measured climate data, the indicated mean-value functions and rational filters have been identified for different months of a year. Stochastic differential equations in the state vector form driven by white noise processes have been established, and analytical solutions for the mean-value function and covariance matrix of the state vector are obtained. This framework would allow a simple and efficient way to carry out predictions and parametric studies on energy dynamics of buildings with random and uncertain climate effects. It would also provide a basis for the robust design of energy efficient buildings with predictive controllers.