In this paper a state space representation of a turbocharged diesel engine is provided based on off-line least square method. Internal combustion engines show high nonlinear behavior due to complicated combustion phenomena and air flow dynamics inside the engine. In development phase of modern control methods like LQR controller, an accurate state space model with meaningful and measurable states is required. Identification is the method of deriving a mathematical model for dynamic systems based on input-output data. In this paper a mean value model of a turbocharged diesel engine is employed to generate demanded input-output data for identification purposes. This nonlinear mean value model predicts engine speed as a function mass of fuel injected per cycle, injection timing (ξ), ambient pressure and temperature and external loads. In the next step the simulation data is used to develop a state space model around idle mode operation state. Least square method is then employed to identify a linear time invariant state space model out of input-output data. In doing so, band limited white noise is used to generate demanded I/O data for model identification purposes. In the next step subsequent results are used to identify the LTI model based on LS. Load is considered as a disturbance while mass of injected fuel and injection timing is two main inputs of the model. Engine speed is considered the only output. Inlet and exhaust manifolds pressure, turbocharger speed and engine speed are 4 states of engine. Comparison between the nonlinear model results and state space model data show acceptable similarity. The results show that this scheme can be used for online identification of engine in fault detection and adaptive control processes.