The Census Bureau has set up a task force to combat the spread of false or misleading information online about its coming population count, a move that could test the government’s ability to thwart disinformation efforts from affecting the 2020 election.

The agency on Tuesday said its new trust and safety team is working closely with social-media companies such as Twitter Inc. and Facebook Inc., as well as community groups, to identify any online attempts to disrupt its efforts to get an accurate count of the number of U.S....