Flight Instructor reported a NMAC with a VFR aircraft that was not complying with ATC instructions.
Synopsis
Flight Instructor reported a NMAC with a VFR aircraft that was not complying with ATC instructions.
Narrative
We were on a long IFR training flight from ZZZ to PDT and were cleared as filed at 7;000 feet. We had reached cruise and were southeast bound toward PDT. My student pointed out an oncoming aircraft about 10 miles away and 300 feet below us; according to ADS-B. I acknowledge that I will look out for them; as I am acting as safety pilot. As they reach about 5 miles; approach issues a traffic advisory; stating the aircraft is restricted at or below 6;500 ft.; which we found peculiar as they were far higher on our ADS-B. We then hear him issue a similar advisory to that aircraft; telling that pilot that they are indicating 6;900 ft. and to turn left to 270 (about 30 degrees). The pilot acknowledges this but then turns to their right about 30 degrees. At this point; I visually acquire the aircraft at about 2 miles out. Approach makes a second call to the aircraft; stating they were supposed to turn left to 270; and to resume own navigation. The aircraft responds by saying 'turning left to 270' and initiates a sweeping bank to their left; placing them directly in our path. In response; I initiate a climb and advise approach that I am climbing to 7;200 ft. for this traffic warning. As I begin climbing; our traffic alert warning goes off and I see that the oncoming aircraft is within a mile and at our altitude; coming from ahead and slightly from our left. I take controls and sharply bank the aircraft left; again advising approach that I am turning left to 060 for traffic. The aircraft passes off our right wing; and I get back on cleared course. One factor that contributed to this near miss was the other aircraft's presence above 6;500 ft. when they were restricted below it as well as their right turn when they were told to turn left. The second factor that contributed to this was approach's decision to keep us on our course and altitude when this plane was headed toward us at our altitude for about 10 miles. After this occurred; I was told by approach that I cannot deviate from an IFR altitude without asking permission. I responded by saying that I understand but I received a traffic alert and had a very near miss. I do not think he understood how close the near miss was.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.