You are obligated to report all credit-bearing courses to the university where you are pursuing a degree. They get to decide it they want to award transfer credit or not, and whether or not a grade will be transferred or just credits.
Your professor told you to drop the course. So drop it. We don’t tell our students that kind of thing if we don’t think it is their best choice.