The dynamics of a quantum vortex torus knot TP,Q and similar knots in an atomic Bose-Einstein condensate at zero temperature in the Thomas-Fermi regime has been considered in the hydrodynamic approximation. The condensate has a spatially nonuniform equilibrium density profile ρ(z, r) due to an external axisymmetric potential. It is assumed that z * = 0, r * = 1 is a maximum point for function rρ(z, r), with δ(rρ) ≈ −(α − ǫ)z 2 /2 − (α + ǫ)(δr) 2 /2 at small z and δr. Configuration of knot in the cylindrical coordinates is specified by a complex 2πP -periodic functionIn the case |A| ≪ 1 the system is described by relatively simple approximate equations for re-scaled functions Wn(ϕ) ∝ A(2πn + ϕ), where n = 0, . . . , P − 1, and iWn,t = −(Wn,ϕϕ +αWn −ǫW * n )/2− j =n 1/(W * n −W * j ). At ǫ = 0, numerical examples of stable solutions as Wn = θn(ϕ − γt) exp(−iωt) with non-trivial topology have been found for P = 3. Besides that, dynamics of various non-stationary knots with P = 3 was simulated, and in some cases a tendency towards a finite-time singularity has been detected. For P = 2 at small ǫ = 0, rotating around z axis configurations of the form (W0 − W1) ≈ B0 exp(iζ) + ǫC(B0, α) exp(−iζ) + ǫD(B0, α) exp(3iζ) have been investigated, where B0 > 0 is an arbitrary constant, ζ = k0ϕ − Ω0t + ζ0, k0 = Q/2, Ω0 = (k 2 0 − α)/2 − 2/B 2 0 . In the parameter space (α, B0), wide stability regions for such solutions have been found. In unstable bands, a recurrence of the vortex knot to a weakly excited state has been noted to be possible.