We have constructed a 3-dim hydrodynamics code called BTSPH. The fluid dynamics part of the code is based on the smoothed particle hydrodynamics (SPH), and for its Poisson solver the binary tree (BT) scheme is employed. We let the smoothing length in the SPH algorithm vary with space and time, so that resolution of the calculation is considerably enhanced over the version of SPH with fixed smoothing length. The binary tree scheme calculates the gravitational force at a point by collecting the monopole forces from neighboring particles and the multipole forces from aggregates of distant particles. The BTSPH is free from geometric constraints, does not rely on grids, and needs arrays of moderate size. With the code we have run the following set of test calculations: one-dim shock tube, adiabatic collapse of an isothermal cloud, small oscillation of an equilibrium polytrope of index 3/2, and tidal encounter of the polytrope and a point mass perturber. Results of the tests confirmed the code performance.