Most certainly, such attorney or accountant fees are deductible. This is true as long as they were spent in an effort to defend the trust instrument itself; protect the beneficiaries of the trust; administer or manage the trust; or incurred in the pursuit of earning taxable income (such as would be the case in a legal action undertaken for collecting unpaid rent, for example, if the trust owned rental property).
Such costs are directly deductible on Form 1041, Line 14; please see the attached screen-capture image for a visual illustration (simply click the image to open).
Thank you for asking this important question.