how do i set a rotation for a gameobject (3D)

should i use Transform or Rigidbody3D
and how do i do it

by the way i’m using C#

Its depends,

If your object already using Rigidbody 3D, then you should use it.
As the Unity documentation describes, it work faster than using transform:

If you don’t need the use of Rigidtbody3D, then I would use transform.rotation.