WASHINGTON — Attorney General William P. Barr has directed parts of the Justice Department to investigate accusations of discrimination, including claims that the F.B.I. academy weeded out potential agents for not being “masculine enough” and that it has become harder for transgender people to work at the Bureau of Prisons.

Mr. Barr’s request came in response to a letter that he received last week from DOJ Pride, a Justice Department group founded in 1994 to advocate the interests of lesbian, gay, bisexual and transgender employees. Less than half of the group’s members said they believed that the Justice Department does not discriminate against them, the letter said, adding that the finding and others from a survey undertaken in October show that members have become more alienated from the department under the Trump administration.

“Given the crucial role the department fulfills in our society — enforcing the nation’s laws and administering justice — we are concerned that so many employees who dedicate themselves to the department do not think the department values them,” members of DOJ Pride wrote.

In response, Mr. Barr vowed that the Justice Department would not discriminate against workers based on sex, sexual orientation or gender identity, as well as a long list of other “non-merit-based” factors.